README
broccoli-optimize-js
JS optimizer for broccoli using
Installation
npm install --save-dev broccoli-optimize-js
Usage
var optimizeJs = require('broccoli-optimize-js');
var concat = require('broccoli-concat');
var merge = require('broccoli-merge-trees');
var eagerOpt = optimizeJs(eagerSrc, {
mangle: true,
compress: true,
sourceMap: true,
eager: true
});
var lazyOpt = optimizeJs(lazySrc, {
mangle: true,
compress: true,
sourceMap: true
});
var bundle = concat(merge([ lazyOpt, eagerOpt ]), {
outputFile: '/bundle.js',
inputFiles: ['**/*'],
sourceMapConfig: {
enabled: true
},
});
Options
The following options are supported:
eager
hint code for eager parsingmangle
UglifyJS2 manglecompress
UglifyJS2 compress optionsoutput
UglifyJS2 codegen options
Source Maps
Source maps are inlined, this makes caching easier, this is intended to be used
with broccoli-concat
which will split out the source map again.