propertiesify
v1.0.0
Published
A Browserify transform which allows .properties files to be required.
Downloads
1
Maintainers
Readme
propertiesify
A Browserify transform which allows .properties files to be required.
Enables .property files to be required into a module as a JS object hash. Useful for loading localisation resource bundles or configuration.
Installation
Using npm
as a development dependency
npm install propertiesify --save-dev
Configuration
propertiesify uses the properties module and supports the same options
object.
All properties are supported, apart from path
which will be ignored.
Usage
in example/locales/en_US.properties
# en_US
TITLE=Example App
in example/main.js
var resources = require('./locals/en_US.properties');
console.log(resources.TITLE); // Outputs: 'Example App'
Transform with the API
var browserify = require('browserify');
var fs = require('fs');
var b = browserify('example/main.js');
b.transform('propertiesify');
b.bundle().pipe(fs.createWriteStream('bundle.js'));
Transform with CML
browserify example/main.js -t propertiesify > bundle.js