0.0.2 • Published 10 years ago
js-env-compile v0.0.2
js-env-compile
Replaces special directives in your javascript files with environment variables
Example:
TEST_BOOL=true
TEST_NUMBER=5.12
TEST_OBJECT={hi:\'mom\'}
TEST_STRING="'hello world'"
./bin/jsenv <test/fixtures/test.js
/* global $ENV */
var num = $ENV.TEST_NUMBER;
var str = $ENV.TEST_STRING;
var bool = $ENV.TEST_BOOL;
var object = $ENV.TEST_OBJECT;
var missing = $ENV.TEST_MISSING;
console.log(num, str, bool, object);
Output:
/* global $ENV */
var num = 5.12;
var str = 'hello world';
var bool = true;
var object = {hi:'mom'};
var missing = null