node package manager
Orgs are free. Discover, share, and reuse code in your team. Create a free org »

hjsonify

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

Programatic 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);
// => 1000 
$ browserify -t hjsonify app.js | node
1000