1.0.3 • Published 8 years ago

broccoli-optimize-js v1.0.3

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

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 parsing
  • mangle UglifyJS2 mangle
  • compress UglifyJS2 compress options
  • output 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.