1.1.0 • Published 7 years ago

browserify-node-config v1.1.0

Weekly downloads
2
License
ISC
Repository
github
Last release
7 years ago

browserify-node-config

Browserify transform for node-config library.

Install

npm install browserify-node-config

Example

Grunt

var configify = require('browserify-node-config');
// ...
{
  // ...
  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

{
  "ip": "0.0.0.0",
  "port": 80,
  "Client": {
    "testProperty": "hi"
  }
}

Important

  • For support for server-side rendering frameworks, there is no support for watchify at the moment. The entire app must be restarted in order to get config properties which were modified since the server started.