Skip to content

bealearts/propertiesify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

propertiesify Built with Grunt Build Status npm version

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

About

Browserify transform which allows .properties files to be required

Resources

License

Stars

Watchers

Forks

Packages

No packages published