masonexecutable for easily building projects.
You have a dozen site-wide platform dependencies that you want to package in
You have per-page JS assets that you want to package in
During development, you need all of these assets to be included as separate, uncompiled files with line numbers.
During production, you need to flip a switch to minify all these files and include them in the right places.
You want to easily generate static html and css from jade and stylus.
$ npm install -g mason
or use package.json's devDependencies:
use the settings in mason.json:
$ mason build
or using devDependencies:
$ node_modules/.bin/mason build
$ mason watch
(mason is smart about recompiling - it performs the minimum possible build for each file change)
$ mason watch -j debug
!!! 5htmlhead!= mason('platform.js')
mason build injects compressed (uglified) script tags via the
!= mason() local.
To inject individual scripts for debugging, use:
$ mason build -j debug
base: Tells mason.build() where to put your compiled files
src: Used by mason.locals() to render URLs (eg, /compiled/platform.js instead of /work/project/public/compiled/platform.js)
renderer: Specify the default renderer for this asset
var mason = ;mason;
(mason.json resides in __dirname)
var app = ;app;
By default, mason.locals will inject a compressed (uglified) script into your view.
To control how specific assets are injected, use:
var app =config ='platform.js': 'uglify''page.js': 'debug';app;