Skip to content

Commit

Permalink
v3.0.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR committed May 12, 2017
1 parent ccd7ad0 commit 0f45e4e
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 56 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
@@ -1,3 +1,7 @@
v3.0.0:
date: 2017-05-12
changes:
- Update uglify-js to v3.0.4.
v2.3.0:
date: 2017-04-05
changes:
Expand Down
108 changes: 53 additions & 55 deletions README.md
@@ -1,4 +1,4 @@
# grunt-contrib-uglify v2.3.0 [![Build Status: Linux](https://travis-ci.org/gruntjs/grunt-contrib-uglify.svg?branch=master)](https://travis-ci.org/gruntjs/grunt-contrib-uglify) [![Build Status: Windows](https://ci.appveyor.com/api/projects/status/ybtf5vbvtenii561/branch/master?svg=true)](https://ci.appveyor.com/project/gruntjs/grunt-contrib-uglify/branch/master)
# grunt-contrib-uglify v3.0.0 [![Build Status: Linux](https://travis-ci.org/gruntjs/grunt-contrib-uglify.svg?branch=master)](https://travis-ci.org/gruntjs/grunt-contrib-uglify) [![Build Status: Windows](https://ci.appveyor.com/api/projects/status/ybtf5vbvtenii561/branch/master?svg=true)](https://ci.appveyor.com/project/gruntjs/grunt-contrib-uglify/branch/master)

> Minify JavaScript files with UglifyJS
Expand Down Expand Up @@ -28,10 +28,26 @@ Task targets, files and options may be specified according to the grunt [Configu

### Options

This task primarily delegates to [UglifyJS2][], so please consider the [UglifyJS documentation][] as required reading for advanced configuration.
This task primarily delegates to [UglifyJS](https://github.com/mishoo/UglifyJS2), so please consider their documentation as required reading for advanced configuration.

[UglifyJS2]: https://github.com/mishoo/UglifyJS2
[UglifyJS documentation]: http://lisperator.net/uglifyjs/

###### Deprecated options from `2.x`

Option | Replacement
----------------------- | -----------
ASCIIOnly | output.ascii_only
enclose | —
exportAll | —
expression | parse.expression
indentLevel | output.indent_level
mangleProperties | mangle.properties
maxLineLen | output.max\_line_len
preserveComments | output.comments
quoteStyle | output.quote_style
screwIE8 | !ie8
sourceMapIncludeSources | sourceMap.includeSources
sourceMapRoot | sourceMap.root
sourceMapUrl | sourceMap.url


#### mangle
Expand All @@ -50,9 +66,9 @@ Turn on or off source compression with default options. If an `Object` is specif
Type: `Boolean` `Object`
Default: `false`

Turns on beautification of the generated source code. An `Object` will be merged and passed with the options sent to `UglifyJS.OutputStream()`. [View all options here](https://github.com/mishoo/UglifyJS2#beautifier-options)
Turns on beautification of the generated source code. [View all options here](https://github.com/mishoo/UglifyJS2#beautifier-options)

###### expression
###### parse.expression
Type: `Boolean`
Default: `false`

Expand Down Expand Up @@ -86,33 +102,26 @@ The location of an input source map from an earlier compilation, e.g. from Coffe
uglify source is passed as the argument and the return value will be used as the sourceMap name. This only makes sense
when there's one source file.

#### sourceMapIncludeSources
#### sourceMap.includeSources
Type: `Boolean`
Default: `false`

Pass this flag if you want to include the content of source files in the source map as sourcesContent property.

###### sourceMapRoot
###### sourceMap.root
Type: `String`
Default: `undefined`

With this option you can customize root URL that browser will use when looking for sources.

If the sources are not absolute URLs after prepending of the `sourceMapRoot`, the sources are resolved relative to the source map.
If the sources are not absolute URLs after prepending of the `sourceMap.root`, the sources are resolved relative to the source map.

#### sourceMapUrl
#### sourceMap.url
Type: `String`
Default: `undefined`

Override the calculated value for `sourceMappingURL` in the source map. This is useful if the source map location is not relative to the base path of the minified file, i.e. when using a CDN

###### enclose
Type: `Object`
Default: `undefined`

Wrap all of the code in a closure with a configurable arguments/parameters list.
Each key-value pair in the `enclose` object is effectively an argument-parameter pair.

#### wrap
Type: `String`
Default: `undefined`
Expand All @@ -121,25 +130,13 @@ Wrap all of the code in a closure, an easy way to make sure nothing is leaking.
For variables that need to be public `exports` and `global` variables are made available.
The value of wrap is the global variable exports will be available as.

#### maxLineLen
Type: `Number`
Default: `32000`

Limit the line length in symbols. Pass maxLineLen = 0 to disable this safety feature.

#### ASCIIOnly
#### output.ascii_only
Type: `Boolean`
Default: `false`

Enables to encode non-ASCII characters as \uXXXX.

#### exportAll
Type: `Boolean`
Default: `false`

When using `wrap` this will make all global functions and variables available via the export variable.

#### preserveComments
#### output.comments
Type: `Boolean` `String` `Function`
Default: `undefined`
Options: `false` `'all'` `'some'`
Expand All @@ -164,13 +161,13 @@ Default: `''`

This string will be appended to the minified output. Template strings (e.g. `<%= config.value %>` will be expanded automatically.

#### screwIE8
#### ie8
Type: `Boolean`
Default: `true`
Default: `false`

Set this to `false` if you still care about full compliance with Internet Explorer 6-8 quirks.
Set this to `true` if you still care about full compliance with Internet Explorer 6-8 quirks.

#### mangleProperties
#### mangle.properties
Type: `Boolean` `Object`
Default: `false`

Expand All @@ -180,13 +177,13 @@ Turn on or off property mangling with default options. If an `Object` is specifi
Type: `Boolean`
Default: `false`

Use this flag in conjunction with `mangleProperties` to prevent built-in browser object properties from being mangled.
Use this flag in conjunction with `mangle.properties` to prevent built-in browser object properties from being mangled.

#### exceptionsFiles
Type: `Array`
Default: `[]`

Use this with `mangleProperties` to pass one or more JSON files containing a list of variables and object properties
Use this with `mangle.properties` to pass one or more JSON files containing a list of variables and object properties
that should not be mangled. See the [UglifyJS docs](https://www.npmjs.com/package/uglify-js) for more info on the file syntax.

#### nameCache
Expand All @@ -196,7 +193,7 @@ Default: `''`
A string that is a path to a JSON cache file that uglify will create and use to coordinate symbol mangling between
multiple runs of uglify. Note: this generated file uses the same JSON format as the `exceptionsFiles` files.

#### quoteStyle
#### output.quote_style
Type: `Integer`
Default: `0`

Expand Down Expand Up @@ -248,15 +245,15 @@ grunt.initConfig({

#### Reserved identifiers

You can specify identifiers to leave untouched with an `except` array in the `mangle` options.
You can specify identifiers to leave untouched with an `reserved` array in the `mangle` options.

```js
// Project configuration.
grunt.initConfig({
uglify: {
options: {
mangle: {
except: ['jQuery', 'Backbone']
reserved: ['jQuery', 'Backbone']
}
},
my_target: {
Expand Down Expand Up @@ -294,7 +291,7 @@ grunt.initConfig({

#### Advanced source maps

Set the `sourceMapIncludeSources` option to `true` to embed your sources directly into the map. To include
Set the `sourceMap.includeSources` option to `true` to embed your sources directly into the map. To include
a source map from a previous compilation pass it as the value of the `sourceMapIn` option.

```js
Expand All @@ -303,8 +300,9 @@ grunt.initConfig({
uglify: {
my_target: {
options: {
sourceMap: true,
sourceMapIncludeSources: true,
sourceMap: {
includeSources: true
},
sourceMapIn: 'example/coffeescript-sourcemap.js', // input sourcemap from a previous compilation
},
files: {
Expand All @@ -315,7 +313,7 @@ grunt.initConfig({
});
```

Refer to the [UglifyJS SourceMap Documentation](http://lisperator.net/uglifyjs/codegen#source-map) for more information.
Refer to the [UglifyJS SourceMap Documentation](https://github.com/mishoo/UglifyJS2#source-map-options) for more information.

#### Turn off console warnings

Expand Down Expand Up @@ -343,11 +341,9 @@ grunt.initConfig({
#### Beautify

Specify `beautify: true` to beautify your code for debugging/troubleshooting purposes.
Pass an object to manually configure any other output options passed directly to `UglifyJS.OutputStream()`.

See [UglifyJS Codegen documentation](http://lisperator.net/uglifyjs/codegen) for more information.
Pass an object to manually configure any other output options.

_Note that manual configuration will require you to explicitly set `beautify: true` if you want traditional, beautified output._
See [UglifyJS documentation](https://github.com/mishoo/UglifyJS2#beautifier-options) for more information.

```js
// Project configuration.
Expand All @@ -364,8 +360,7 @@ grunt.initConfig({
my_advanced_target: {
options: {
beautify: {
width: 80,
beautify: true
width: 80
}
},
files: {
Expand Down Expand Up @@ -402,9 +397,9 @@ grunt.initConfig({

#### Conditional compilation

You can also enable UglifyJS conditional compilation. This is commonly used to remove debug code blocks for production builds. This is equivalent to the command line [`--define` option](https://github.com/mishoo/UglifyJS#use-as-a-code-pre-processor).
You can also enable UglifyJS conditional compilation. This is commonly used to remove debug code blocks for production builds. This is equivalent to the command line `--define` option.

See [UglifyJS global definitions documentation](http://lisperator.net/uglifyjs/compress#global-defs) for more information.
See [UglifyJS global definitions documentation](https://github.com/mishoo/UglifyJS2#conditional-compilation) for more information.

```js
// Project configuration.
Expand Down Expand Up @@ -459,7 +454,7 @@ uglify: {
dev: {
options: {
mangle: {
except: ['jQuery']
reserved: ['jQuery']
}
},
files: [{
Expand Down Expand Up @@ -489,7 +484,9 @@ on the format of the exception file format please see the [UglifyJS docs](https:
grunt.initConfig({
uglify: {
options: {
mangleProperties: true,
mangle: {
properties: true
},
reserveDOMCache: true,
exceptionsFiles: [ 'myExceptionsFile.json' ]
},
Expand Down Expand Up @@ -528,6 +525,7 @@ grunt.initConfig({

## Release History

* 2017-05-12   v3.0.0   Update uglify-js to v3.0.4.
* 2017-04-05   v2.3.0   Make CLI output less verbose.
* 2017-03-31   v2.2.1   Fix banner option.
* 2017-03-01   v2.2.0   Update uglify-js to v2.8.3.
Expand Down Expand Up @@ -571,4 +569,4 @@ grunt.initConfig({

Task submitted by ["Cowboy" Ben Alman](http://benalman.com)

*This file was generated on Wed Apr 05 2017 00:24:18.*
*This file was generated on Fri May 12 2017 15:02:06.*
2 changes: 1 addition & 1 deletion package.json
@@ -1,7 +1,7 @@
{
"name": "grunt-contrib-uglify",
"description": "Minify JavaScript files with UglifyJS",
"version": "2.3.0",
"version": "3.0.0",
"author": {
"name": "Grunt Team",
"url": "http://gruntjs.com/"
Expand Down

0 comments on commit 0f45e4e

Please sign in to comment.