A Browserify transform for hjson files.
JavaScript
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.editorconfig
.eslintrc
.gitignore
LICENSE
README.md
gulpfile.js
package.json

README.md

NPM version shield License shield

hjsonify

hjsonify is a browserify transform to require Human JSON (Hjson) files.

Require Hjson files in your files just like you would a JSON file.

Install

$ npm install hjsonify

Usage

Programmatic use with Browserify:

var b = require('browserify')(),
    fs = require('fs'),
    hjsonify = require('hjsonify');

b.add('./app.js');
b.transform(hjsonify);
b.bundle().pipe(fs.createWriteStream('./bundle.js'));

CLI use with Browserify:

$ browserify -t hjsonify app.js > bundle.js

Example

config.hjson:

{
  port: 1000 //defaults to 80
}

app.js:

var config = require('./config.hjson');
console.log(config.port);
$ browserify -t hjsonify app.js | node
1000