From aeb474ec0fb4c4fcba34195767af5c5d6d1230ce Mon Sep 17 00:00:00 2001 From: Michael Ciniawsky Date: Thu, 29 Jun 2017 06:53:42 +0200 Subject: [PATCH] squash: styling --- README.md | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 76311942..d14daebc 100644 --- a/README.md +++ b/README.md @@ -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 ```

Usage

@@ -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}`| /\.js($|\?)/i |Test to match files against| -|**`include`**|`{RegExp\|Array}|`undefined`|Test only `include` files| -|**`exclude`**|`{RegExp\|Array}|`undefined`|Files to `exclude` from testing| +|**`include`**|`{RegExp\|Array}`|`undefined`|Test only `include` files| +|**`exclude`**|`{RegExp\|Array}`|`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): @@ -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`