Install package with NPM and add it to your development dependencies:
npm install --save-dev gulp-uglify
var gulp = ;var uglify = ;var pump = ;gulp;
Most of the minify options from the UglifyJS API are supported. There are a few exceptions:
sourceMapoption must not be set, as it will be automatically configured based on your Gulp configuration. See the documentation for Gulp sourcemaps.
gulp-uglify emits an 'error' event if it is unable to minify a specific file.
The GulpUglifyError constructor is exported by this plugin for
It contains the following properties:
fileName: The full file path for the file being minified.
cause: The original UglifyJS error, if available.
Most UglifyJS error messages have the following properties:
To see useful error messages, see Why Use Pump?.
Using a Different UglifyJS
gulp-uglify uses the version of UglifyJS installed as a dependency.
It's possible to configure the use of a different version using the "composer" entry point.
var uglifyjs = ; // can be a git checkout// or another module (such as `uglify-es` for ES6 support)var composer = ;var pump = ;var minify = ;gulp;