git ignore updates

This commit is contained in:
Vadim Namniak
2015-05-05 23:53:15 -04:00
parent 66da3411c3
commit 5f12d60d12
139 changed files with 1813 additions and 6499 deletions
+215 -58
View File
@@ -1,11 +1,11 @@
# grunt-contrib-uglify v0.2.6 [![Build Status](https://travis-ci.org/gruntjs/grunt-contrib-uglify.png?branch=master)](https://travis-ci.org/gruntjs/grunt-contrib-uglify)
# grunt-contrib-uglify v0.9.1 [![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 files with UglifyJS.
## Getting Started
This plugin requires Grunt `~0.4.0`
This plugin requires Grunt `>=0.4.0`
If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
@@ -26,6 +26,28 @@ grunt.loadNpmTasks('grunt-contrib-uglify');
_Run this task with the `grunt uglify` command._
Task targets, files and options may be specified according to the grunt [Configuring tasks](http://gruntjs.com/configuring-tasks) guide.
### Migrating from 2.x to 3.x
Version `3.x` introduced changes to configuring source maps. Accordingly, if you don't use the source map options you should be able to upgrade seamlessly. If you do use source maps, see below.
#### Removed options
`sourceMappingURL` - This is calculated automatically now
`sourceMapPrefix` - No longer necessary for the above reason
#### Changed options
`sourceMap` - Only accepts a `Boolean` value. Generates a map with a default name for you
`sourceMapRoot` - The location of your sources is now calculated for you when `sourceMap` is set to `true` but you can set manual source root if needed
#### New options
`sourceMapName` - Accepts a string or function to change the location or name of your map
`sourceMapIncludeSources` - Embed the content of your source files directly into the map
`expression` - Accepts a `Boolean` value. Parse a single expression (JSON or single functions)
`quoteStyle` - Accepts integers `0` (default), `1`, `2`, `3`. Enforce or preserve quotation mark style.
### Options
This task primarily delegates to [UglifyJS2][], so please consider the [UglifyJS documentation][] as required reading for advanced configuration.
@@ -33,96 +55,108 @@ This task primarily delegates to [UglifyJS2][], so please consider the [UglifyJS
[UglifyJS2]: https://github.com/mishoo/UglifyJS2
[UglifyJS documentation]: http://lisperator.net/uglifyjs/
#### mangle
Type: `Boolean` `Object`
Type: `Boolean` `Object`
Default: `{}`
Turn on or off mangling with default options. If an `Object` is specified, it is passed directly to `ast.mangle_names()` *and* `ast.compute_char_frequency()` (mimicking command line behavior).
Turn on or off mangling with default options. If an `Object` is specified, it is passed directly to `ast.mangle_names()` *and* `ast.compute_char_frequency()` (mimicking command line behavior). [View all options here](https://github.com/mishoo/UglifyJS2#mangler-options).
#### compress
Type: `Boolean` `Object`
Type: `Boolean` `Object`
Default: `{}`
Turn on or off source compression with default options. If an `Object` is specified, it is passed as options to `UglifyJS.Compressor()`.
Turn on or off source compression with default options. If an `Object` is specified, it is passed as options to `UglifyJS.Compressor()`. [View all options here](https://github.com/mishoo/UglifyJS2#compressor-options).
#### beautify
Type: `Boolean` `Object`
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()`
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)
###### expression
Type: `Boolean`
Default: `false`
Parse a single expression, rather than a program (for parsing JSON)
#### report
Choices: `false` `'min'` `'gzip'`
Default: `false`
Choices: `'min'`, `'gzip'`
Default: `'min'`
Either do not report anything, report only minification result, or report minification and gzip results. This is useful to see exactly how well Uglify is performing, but using `'gzip'` can add 5-10x runtime task execution.
Example ouput using `'gzip'`:
```
Original: 198444 bytes.
Minified: 101615 bytes.
Gzipped: 20084 bytes.
```
Either report only minification result or report minification and gzip results.
This is useful to see exactly how well clean-css is performing but using `'gzip'` will make the task take 5-10x longer to complete. [Example output](https://github.com/sindresorhus/maxmin#readme).
#### sourceMap
Type: `String` `Function`
Type: `Boolean`
Default: `false`
If `true`, a source map file will be generated in the same directory as the `dest` file. By default it will have the same basename as the `dest` file, but with a `.map` extension.
#### sourceMapName
Type: `String` `Function`
Default: `undefined`
The location to output the sourcemap. If a function is provided, the uglify destination is passed as the argument
and the return value will be used as the sourceMap name.
#### sourceMapRoot
Type: `String`
Default: `undefined`
The location where your source files can be found. This sets the sourceRoot field in the source map.
To customize the name or location of the generated source map, pass a string to indicate where to write the source map to. If a function is provided, the uglify destination is passed as the argument and the return value will be used as the file name.
#### sourceMapIn
Type: `String` `Function`
Type: `String` `Function`
Default: `undefined`
The location of an input source map from an earlier compilation, e.g. from CoffeeScript. If a function is provided, the
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.
#### sourceMappingURL
Type: `String` `Function`
#### sourceMapIncludeSources
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
Type: `String`
Default: `undefined`
The location of your sourcemap. Defaults to the location you use for sourceMap, override if you need finer control. Provide
a function to dynamically generate the sourceMappingURL based off the destination.
With this option you can customize root URL that browser will use when looking for sources.
#### sourceMapPrefix
Type: `Number`
Default: `undefined`
The number of directories to drop from the path prefix when declaring files in the source map.
If the sources are not absolute URLs after prepending of the `sourceMapRoot`, the sources are resolved relative to the source map.
###### enclose
Type: `Object`
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`
Type: `String`
Default: `undefined`
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
Type: `Boolean`
Default: `false`
Enables to encode non-ASCII characters as \uXXXX.
#### exportAll
Type: `Boolean`
Type: `Boolean`
Default: `false`
When using `wrap` this will make all global functions and variables available via the export variable.
#### preserveComments
Type: `Boolean` `String` `Function`
Default: `undefined`
Type: `Boolean` `String` `Function`
Default: `undefined`
Options: `false` `'all'` `'some'`
Turn on preservation of comments.
@@ -133,21 +167,59 @@ Turn on preservation of comments.
- `Function` specify your own comment preservation function. You will be passed the current node and the current comment and are expected to return either `true` or `false`
#### banner
Type: `String`
Type: `String`
Default: empty string
This string will be prepended to the beginning of the minified output. It is processed using [grunt.template.process][], using the default options.
This string will be prepended to the minified output. Template strings (e.g. `<%= config.value %>` will be expanded automatically.
#### footer
Type: `String`
Type: `String`
Default: empty string
This string will be append to the end of the minified output. It is processed using [grunt.template.process][], using the default options.
This string will be appended to the minified output. Template strings (e.g. `<%= config.value %>` will be expanded automatically.
_(Default processing options are explained in the [grunt.template.process][] documentation)_
#### screwIE8
Type: `Boolean`
Default: false
[grunt.template.process]: https://github.com/gruntjs/grunt/wiki/grunt.template#wiki-grunt-template-process
Pass this flag if you don't care about full compliance with Internet Explorer 6-8 quirks.
#### mangleProperties
Type: `Boolean`
Default: false
Use this flag to turn on object property name mangling.
#### reserveDOMProperties
Type: `Boolean`
Default: false
Use this flag in conjunction with `mangleProperties` 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
that should not be mangled. See the [UglifyJS docs](https://www.npmjs.com/package/uglify-js) for more info on the file syntax.
#### nameCache
Type: `String`
Default: empty string
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
Type: `Integer`
Default: `0`
Preserve or enforce quotation mark style.
* `0` will use single or double quotes such as to minimize the number of bytes (prefers double quotes when both will do)
* `1` will always use single quotes
* `2` will always use double quotes
* `3` will preserve original quotation marks
### Usage examples
@@ -212,7 +284,10 @@ grunt.initConfig({
#### Source maps
Configure basic source map output by specifying a file path for the `sourceMap` option.
Generate a source map by setting the `sourceMap` option to `true`. The generated
source map will be in the same directory as the destination file. Its name will be the
basename of the destination file with a `.map` extension. Override these
defaults with the `sourceMapName` attribute.
```js
// Project configuration.
@@ -220,7 +295,8 @@ grunt.initConfig({
uglify: {
my_target: {
options: {
sourceMap: 'path/to/source-map.js'
sourceMap: true,
sourceMapName: 'path/to/sourcemap.map'
},
files: {
'dest/output.min.js': ['src/input.js']
@@ -232,10 +308,8 @@ grunt.initConfig({
#### Advanced source maps
You can specify the parameters to pass to `UglifyJS.SourceMap()` which will
allow you to configure advanced settings.
Refer to the [UglifyJS SourceMap Documentation](http://lisperator.net/uglifyjs/codegen#source-map) for more information.
Set the `sourceMapIncludeSources` 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
// Project configuration.
@@ -243,8 +317,8 @@ grunt.initConfig({
uglify: {
my_target: {
options: {
sourceMap: 'path/to/source-map.js',
sourceMapRoot: 'http://example.com/path/to/src/', // the location to find your original source
sourceMap: true,
sourceMapIncludeSources: true,
sourceMapIn: 'example/coffeescript-sourcemap.js', // input sourcemap from a previous compilation
},
files: {
@@ -255,6 +329,30 @@ grunt.initConfig({
});
```
Refer to the [UglifyJS SourceMap Documentation](http://lisperator.net/uglifyjs/codegen#source-map) for more information.
#### Turn off console warnings
Specify `drop_console: true` as part of the `compress` options to discard calls to `console.*` functions.
This will supress warning messages in the console.
```js
// Project configuration.
grunt.initConfig({
uglify: {
options: {
compress: {
drop_console: true
}
},
my_target: {
files: {
'dest/output.min.js': ['src/input.js']
}
}
}
});
```
#### Beautify
@@ -342,6 +440,7 @@ grunt.initConfig({
}
});
```
#### Compiling all files in a folder dynamically
This configuration will compress and mangle the files dynamically.
@@ -362,9 +461,67 @@ grunt.initConfig({
});
```
#### Turn on object property name mangling
This configuration will turn on object property name mangling, but not mangle built-in browser object properties.
Additionally, variables and object properties listed in the `myExceptionsFile.json` will be mangled. For more info,
on the format of the exception file format please see the [UglifyJS docs](https://www.npmjs.com/package/uglify-js).
```js
// Project configuration.
grunt.initConfig({
uglify: {
options: {
mangleProperties: true,
reserveDOMCache: true,
exceptionsFiles: [ 'myExceptionsFile.json' ]
},
my_target: {
files: {
'dest/output.min.js': ['src/input.js']
}
}
}
});
```
#### Turn on use of name mangling cache
Turn on use of name mangling cache to coordinate mangled symbols between outputted uglify files. uglify will the
generate a JSON cache file with the name provided in the options. Note: this generated file uses the same JSON format
as the `exceptionsFiles` files.
```js
// Project configuration.
grunt.initConfig({
uglify: {
options: {
nameCache: '.tmp/grunt-uglify-cache.json',
},
my_target: {
files: {
'dest/output1.min.js': ['src/input1.js'],
'dest/output2.min.js': ['src/input2.js']
}
}
}
});
```
## Release History
* 2015-04-07v0.9.0added hook into uglify's mangling functionality
* 2015-03-30v0.8.1lock uglify to 2.4.17 due to breaking changes
* 2015-02-19v0.8.0Add `screwIE8` option. Fix issue with explicit `compress` in node 0.12.0.
* 2014-12-23v0.7.0Adds sourceMapRoot options. Updates readme descriptions. Removes reference to cleancss.
* 2014-09-17v0.6.0Output fixes. ASCIIOnly option. Other fixes.
* 2014-07-25v0.5.1Chalk updates. Output updates.
* 2014-03-01v0.4.0remove grunt-lib-contrib dependency and add more colors
* 2014-02-27v0.3.3remove unnecessary calls to `grunt.template.process`
* 2014-01-22v0.3.2fix handling of `sourceMapIncludeSources` option.
* 2014-01-20v0.3.1fix relative path issue in sourcemaps
* 2014-01-16v0.3.0refactor sourcemap support
* 2013-11-09v0.2.7prepending banner if sourceMap option not set, addresses
* 2013-11-08v0.2.6merged 45, 53, 85 (105 by way of duping 53) Added support for banners in uglified files with sourcemaps Updated docs
* 2013-10-28v0.2.5Added warning for banners when using sourcemaps
@@ -383,4 +540,4 @@ grunt.initConfig({
Task submitted by ["Cowboy" Ben Alman](http://benalman.com)
*This file was generated on Sat Nov 09 2013 12:42:05.*
*This file was generated on Tue Apr 07 2015 21:04:14.*