gulp-uglify

WebJar for gulp-uglify

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

gulp-uglify
Last Version

Last Version

3.0.2
Release Date

Release Date

Type

Type

jar
Description

Description

gulp-uglify
WebJar for gulp-uglify
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/terinjokes/gulp-uglify

Download gulp-uglify

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/gulp-uglify/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>gulp-uglify</artifactId>
    <version>3.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/gulp-uglify/
implementation 'org.webjars.npm:gulp-uglify:3.0.2'
// https://jarcasting.com/artifacts/org.webjars.npm/gulp-uglify/
implementation ("org.webjars.npm:gulp-uglify:3.0.2")
'org.webjars.npm:gulp-uglify:jar:3.0.2'
<dependency org="org.webjars.npm" name="gulp-uglify" rev="3.0.2">
  <artifact name="gulp-uglify" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='gulp-uglify', version='3.0.2')
)
libraryDependencies += "org.webjars.npm" % "gulp-uglify" % "3.0.2"
[org.webjars.npm/gulp-uglify "3.0.2"]

Dependencies

compile (10)

Group / Artifact Type Version
org.webjars.npm : array-each jar [1.0.1,2)
org.webjars.npm : isobject jar [3.0.1,4)
org.webjars.npm : uglify-js jar [3.0.5,4)
org.webjars.npm : make-error-cause jar [1.1.1,2)
org.webjars.npm : has-gulplog jar [0.1.0,0.2)
org.webjars.npm : vinyl-sourcemaps-apply jar [0.2.0,0.3)
org.webjars.npm : extend-shallow jar [3.0.2,4)
org.webjars.npm : gulplog jar [1.0.0,2)
org.webjars.npm : safe-buffer jar [5.1.2,6)
org.webjars.npm : through2 jar [2.0.0,3)

Project Modules

There are no modules declared in this project.

gulp-uglify

Minify JavaScript with UglifyJS3.

Installation

Install package with NPM and add it to your development dependencies:

npm install --save-dev gulp-uglify

Usage

var gulp = require('gulp');
var uglify = require('gulp-uglify');
var pipeline = require('readable-stream').pipeline;

gulp.task('compress', function () {
  return pipeline(
        gulp.src('lib/*.js'),
        uglify(),
        gulp.dest('dist')
  );
});

To help properly handle error conditions with Node streams, this project recommends the use of pipeline, from readable-stream.

Options

Most of the minify options from the UglifyJS API are supported. There are a few exceptions:

  1. The sourceMap option must not be set, as it will be automatically configured based on your Gulp configuration. See the documentation for Gulp sourcemaps.

Errors

gulp-uglify emits an 'error' event if it is unable to minify a specific file. The GulpUglifyError constructor is exported by this plugin for instanceof checks. 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:

  • message (or msg)
  • filename
  • line

To see useful error messages, see Why Use Pipeline?.

Using a Different UglifyJS

By default, 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 = require('uglify-js'); // can be a git checkout
                                     // or another module (such as `uglify-es` for ES6 support)
var composer = require('gulp-uglify/composer');
var pump = require('pump');

var minify = composer(uglifyjs, console);

gulp.task('compress', function (cb) {
  // the same options as described above
  var options = {};

  pump([
      gulp.src('lib/*.js'),
      minify(options),
      gulp.dest('dist')
    ],
    cb
  );
});

Versions

Version
3.0.2
3.0.1
3.0.0
2.1.2
2.0.0
1.5.4
1.5.3
1.2.0