A JavaScript compacting middleware for express
npm install compact
npm install compact
``js`
var compact = require('compact').createCompact({
srcPath: __dirname + '/public/src/',
destPath: __dirname + '/public/compact/',
webPath: '/js/compact/',
debug: false
});
- srcPath is the path to your frontend JavaScript. (If you initialised your project with Express' quick start, you probably want to set this to /public/javascripts).destPath
- is the path that compact should use to store the compacted assets.webPath
If this directory does not exist, it will be created.
- is the public public facing route to your destPath (This will preceed the filename of the output
`
And on /blog you'd get this
`html`
You also have access to the compactJs()` helper which will return an array
of files instead of the rendered html.