Wantworthy / assembly

build tool to assemble client side javascript projects
5 stars 2 forks source link

json compiler #15

Closed ryanfitz closed 12 years ago

ryanfitz commented 12 years ago

create a compiler for json files to generate javascript configs. Use NODE_ENV to compile out the proper config sections (process.env.NODE_ENV) for example

// filename: assets/config.json

"development" : {
  "database" : "mongo://127.0.0.1:7000",
  "host" : "http://localhost"
},

"production" : {
  "database" : "mongo://db.production.com:7000",
  "host" : "http://www.production.com"
}

when running as NODE_ENV=production then compile out to:

// filename: js/config.js

define("js/config", [ "require", "module", "exports" ], function(require, module, exports) {
 module.exports = { "database" : "mongo://db.production.com:7000", "host" : "http://www.production.com"}
});