Skip to content
This repository has been archived by the owner on Dec 5, 2019. It is now read-only.

Commit

Permalink
squash: styling
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-ciniawsky committed Jun 29, 2017
1 parent b732259 commit aeb474e
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,11 @@ npm install uglifyjs-webpack-plugin --save-dev
yarn add uglifyjs-webpack-plugin --dev
```

⚠️ The plugin has a peer dependency to uglify-js, so in order to use the plugin, also uglify-js has to be installed. The currently (2017/1/25) available uglify-js npm packages; however, do not support minification of ES6 code. In order to support ES6, an ES6-capable, a.k.a. _harmony_, version of UglifyJS has to be provided.

If your minification target is ES6:

```bash
yarn add git://github.com/mishoo/UglifyJS2#harmony-v2.8.22 --dev
```

If your minification target is ES5:
> ⚠️ The plugin has a peer dependency to uglify-es (UglifyJS), so in order to use the plugin, also uglify-js has to be installed.
```bash
yarn add uglify-js --dev
npm install uglify-es --save-dev
yarn add uglify-es --dev
```

<h2 align="center">Usage</h2>
Expand All @@ -58,19 +51,19 @@ This plugin supports UglifyJS features as discussed below:
|Name|Type|Default|Description|
|:--:|:--:|:-----:|:----------|
|**`compress`**|`{Boolean\|Object}`|`true`|See [UglifyJS documentation](http://lisperator.net/uglifyjs/compress)|
|**`mangle`**|`{Boolean\|Object}`|`true`|See |
|**`mangle`**|`{Boolean\|Object}`|`true`|See [below](https://github.com/webpack-contrib/uglifyjs-webpack-plugin/tree/readme#mangle)|
|**`beautify`**|`{Boolean}`|`false`|Beautify output|
|**`output`**|`{Object}`|`{}`|An object providing options for UglifyJS [OutputStream](https://github.com/mishoo/UglifyJS2/blob/v2.x/lib/output.js) (Lower level access to `Uglifyjs` output)|
|**`comments`**|{Boolean\|RegExp\|Function<(node, comment) -> {Boolean}>}`| Defaults to preserving comments containing `/*!`, `/**!`, `@preserve` or `@license`. | Comment related configuration. |
|**`extractComments`**|{Boolean\|RegExp}\|Function<(node, comment) -> {Boolean\|Object}}`|`false`| Whether comments shall be extracted to a separate file, (see [details](https://github.com/webpack/webpack/commit/71933e979e51c533b432658d5e37917f9e71595a), since webpack 2.3.0)|
|**`comments`**|`{Boolean\|RegExp\|Function<(node, comment) -> {Boolean}>}`| Defaults to preserving comments containing `/*!`, `/**!`, `@preserve` or `@license`. |Comment related configuration|
|**`extractComments`**|`{Boolean\|RegExp\|Function<(node, comment) -> {Boolean\|Object}>}`|`false`| Whether comments shall be extracted to a separate file, (see [details](https://github.com/webpack/webpack/commit/71933e979e51c533b432658d5e37917f9e71595a), since webpack 2.3.0)|
|**`sourceMap`**|`{Boolean}`|`false`|Use SourceMaps to map error message locations to modules. This slows down the compilation. ⚠️ **`cheap-source-map` options don't work with the plugin!**|
|**`test`**|`{RegExp\|Array<RegExp>}`| <code>/\.js($&#124;\?)/i</code> |Test to match files against|
|**`include`**|`{RegExp\|Array<RegExp>}|`undefined`|Test only `include` files|
|**`exclude`**|`{RegExp\|Array<RegExp>}|`undefined`|Files to `exclude` from testing|
|**`include`**|`{RegExp\|Array<RegExp>}`|`undefined`|Test only `include` files|
|**`exclude`**|`{RegExp\|Array<RegExp>}`|`undefined`|Files to `exclude` from testing|
|**`warningsFilter`**|{`Function(source) -> {Boolean}}`|``|Allow to filter uglify warnings (since webpack 2.3.0)|


### `Mangling`
### `mangle`

`mangle (boolean|object)` - Passing `true` or an object enables and provides options for UglifyJS name mangling. See [UglifyJS documentation](https://github.com/mishoo/UglifyJS2/tree/v2.x#mangle) for mangle options. Example configuration, this will **not** mangle properties (see below):

Expand All @@ -97,7 +90,7 @@ new UglifyJsPlugin({
})
```

### `Extracting Comments`
### `extractComments`

The `extractComments` option can be
- `true`: All comments that normally would be preserved by the `comments` option will be moved to a separate file. If the original file is named `foo.js`, then the comments will be stored to `foo.js.LICENSE`
Expand Down

0 comments on commit aeb474e

Please sign in to comment.