Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

minify-stream

goto-bus-stop245.4kMIT2.1.0

minify javascript in a stream using uglify-js

minify, stream, uglify-js

readme

minify-stream

minify javascript in a stream using uglify-js

npm travis standard

Install

npm install minify-stream

Usage

var minifyStream = require('minify-stream')

fs.createReadStream('app.js')
  .pipe(minifyStream())
  .pipe(fs.createWriteStream('app.min.js'))

API

minifyStream(?options)

Create a new minify stream. Write a Javascript file or bundle to it. Possible options are:

  • uglify - An uglify module to use, defaults to terser. It must have an uglify-compatible minify() function.
  • All other options are passed to the minify() function as the second parameter. See the terser docs for available options.

minify-stream adds inline source maps by default. Use exorcist to extract source maps from the output stream into a separate file. If you don't need source maps, pass the sourceMap: false option to disable them.

minifyStream({ sourceMap: false })

License

MIT

changelog

minify-stream change log

All notable changes to this project will be documented in this file.

This project adheres to Semantic Versioning.

2.1.0

  • Support asynchronous uglify implementations. You can now use minify-stream with terser v5:
    var minifyStream = require('minify-stream')
    var minifier = minifyStream({ uglify: require('terser') })

2.0.1

  • Unpin default terser version.

2.0.0

  • Upgrade default terser version to v4.

1.2.1

  • Pin terser to a version that does uses ES5 syntax.
  • Update streams dependencies.

1.2.0

  • Switch to terser as the default uglify module. (#1)

1.1.0

  • Now outputs sourcemaps by default

1.0.0

  • Initial release