auto-updating js combiner for speedy delivery of modular code with node.js
Scrunch performs 4 handy operations:
scrunch.combine(filepath or array_of_filepaths, options);--> returns a function that handles HTTP requests.
on the server...
npm install scrunch
var scrunch = require'scrunch';// for any set of files you want to scrunch (while developing)appget'/scrunch/allfiles.js' scrunchcombine__dirname+'/file1.js'__dirname+'/file2.js'__dirname+'/file3.js'comment: truerefresh: 500verbose: true;// then, turn on the minify/compress options for speedy tiny files!appget'/scrunch/allfiles2.js' scrunchcombine__dirname+'/file1.js'__dirname+'/file2.js'__dirname+'/file3.js'minifyJS: truecompress: true;
in the browser...
<!-- for all files as one, but still readable --><!-- or, for speedy tiny files -->
when true, adds comment before each file for ease of debugging.
specifies in milliseconds how often to check for file updates.
when true, runs the output through Uglify-JS2 to make things small.
when true, sends the HTTP response as gzip/deflate when possible.
sets the content-type header for HTTP response.
sets the max_age in the HTTP response (for browser caching)
This little module was created by The Chaos Collective and is being shared with the Node.js community as open source.
Go make awesome things!