uglify-stream

1.1.0 • Public • Published

uglify-stream

NPM Build Status

Transform stream for UglifyJS

Example

var fs = require('fs');
var uglify = require('uglify-stream');
 
fs.createReadStream('input.js')
    .pipe(uglify())
    .pipe(fs.createWriteStream('output.js'));

API

uglify-stream([opts])

Creates a duplex stream that will compress all JS code piped into it with UglifyJS. UglifyJS is run in a separate process when using this module, which means that it will not block the calling process when compressing, unlike using Uglify directly from Node.

Options

  • compress: Set to false to disable compression
  • mangle: Set to false to disable name mangling

Example: compress browserify bundle

Using a transform stream makes it very simple to compress the bundle output from Browserify:

var browserify = require('browserify');
var uglify = require('uglify-stream');
var bl = require('bl');
 
var b = browserify('my-file.js')
    .bundle()
    .pipe(uglify())
    .pipe(bl(done));
 
function done(err, src) {
    console.log(src.toString());
}

Package Sidebar

Install

npm i uglify-stream

Weekly Downloads

2

Version

1.1.0

License

BSD

Last publish

Collaborators

  • conradz