rjp

require-java-properties

RequireJS loader for Java properties files

Showing:

Popularity

Downloads/wk

0

GitHub Stars

1

Maintenance

Last Commit

5yrs ago

Contributors

1

Package

Dependencies

1

Size (min+gzip)

0.5KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

#require-java-properties

Build Status

a transform for loading Java .properties files in RequireJS, using java.properties.js

Install the plugin and its dependencies using bower

$ bower install java.properties.js --save

If you prefer a manual install, make sure to satisfy the java.properties.js and text dependencies.

Simple usage

First, make sure the module names java.properties.js and text resolve to the proper locations:

requirejs.config({
    paths : {
        'text': './bower_components/requirejs-text/text',
        'java.properties': './bower_components/java.properties.js/dist/amd/java.properties',
        'properties': './bower_components/require-java-properties/properties'
    }
});

Now you're ready to require Java .properties files as plain JavaScript objects:

require('properties!some/folder/afile.properties', function(data){
    console.log(data); // => logs the transformed object
});

NOTE: In contrast to the default java.properties.js behaviour keys with dots in them will not result in nested objects. So a properties key like:

key=12
key.with.dots=foobar 

Will result in this JavaScript object:

{
    "key": 12,
    "key.with.dots": "foobar"
} 

This is due to the specific requirements for which this plugin was build.

Build time

On build time you can simply use stubModules in your build config to get rid of the parser in the file you ship to production:

({
    stubModules: ['text', 'java.properties', 'properties']
})

##License MIT

##Attribution This plugin is a based upon require-yaml.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100