mathew-kurian / node-configify

Browserify transform for node-config (aka. config) library
5 stars 4 forks source link

Configify

Browserify transform for node-config library

Install

npm install config-browserify

Example

Setup (via Grunt OR package.json)

Gruntfile.js

var configify = require('config-browserify');
// ...
{
    // ...
    browserify: {
        options: {
            transform: [configify]
        }
    }
    // ...
}

package.json

{
  "name": "mymodule",
  "browserify": {
    "transform": "config-browserify"
  }
}

Usage

ClientSide.js (which will be bundled by browserify)

var config = require('config');
global.window && console.log(config.get('Client.testProperty')); // prints `hello!`

config/default.json

{
  "Client": {
    "testProperty": "hello!"
  }
}

Important