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

Package detail

gulp-uglify-es

itayronen256.1kMIT3.0.0TypeScript support: included

gulp stream to uglify with 'terser' (es6 supported).

minify, uglify, uglify-es, uglify-es6, terser, es, es6, gulp, gulpplugin

readme

gulp-uglify-es

gulp stream to uglify with 'terser' (es6 supported).

terser is the new 'uglify-es'. uglify-es is no longer maintained.

Install

npm install --save-dev gulp-uglify-es

Usage

gulpfile.js

let gulp = require("gulp");
let rename = require("gulp-rename");
let uglify = require('gulp-uglify-es').default;

gulp.task("uglify", function () {
    return gulp.src("lib/bundle.js")
        .pipe(rename("bundle.min.js"))
        .pipe(uglify(/* options */))
        .pipe(gulp.dest("lib/"));
});

For documentation about the options-object, See the Uglify API Reference.

Source maps

To generate source maps, use gulp-sourcemaps.
Example:

let gulp = require("gulp");
let rename = require("gulp-rename");
var sourcemaps = require('gulp-sourcemaps');
let uglify = require('gulp-uglify-es').default;

gulp.task("uglify", function () {
    return gulp.src("lib/bundle.js")
        .pipe(rename("bundle.min.js"))
        .pipe(sourcemaps.init())
        .pipe(uglify())
        .pipe(sourcemaps.write()) // Inline source maps.
        // For external source map file:
        //.pipe(sourcemaps.write("./maps")) // In this case: lib/maps/bundle.min.js.map
        .pipe(gulp.dest("lib/"));
});

changelog

Changelog

Follows semantic versioning.

1.0.0 (2018-01-18)

  • Version changed to '1.0.0'.