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

Commit c37329b

Browse files
mlazowikmichael-ciniawsky
authored andcommitted
Clarify documentation about mangling (#42)
1 parent c331f38 commit c37329b

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

README.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
src="https://cdn.rawgit.com/webpack/media/e7485eb2/logo/icon.svg">
1313
</a>
1414
<h1>UglifyJS Webpack Plugin</h1>
15-
<p>This plugin uses <a href="https://github.com/mishoo/UglifyJS2">UglifyJS</a> to minify your JavaScript.<p>
15+
<p>This plugin uses <a href="https://github.com/mishoo/UglifyJS2/tree/v2.x">UglifyJS v2</a> to minify your JavaScript.<p>
1616
</div>
1717

1818
> Note that webpack contains the same plugin under `webpack.optimize.UglifyJsPlugin`. This is a standalone version for those that want to control the version of UglifyJS. The documentation is valid apart from the installation instructions in that case.
@@ -69,7 +69,7 @@ This plugin supports UglifyJS features as discussed below:
6969
| compress | boolean, object | true | See [UglifyJS documentation](http://lisperator.net/uglifyjs/compress). |
7070
| mangle | boolean, object | true | See below. |
7171
| beautify | boolean | false | Beautify output. |
72-
| output | An object providing options for UglifyJS [OutputStream](https://github.com/mishoo/UglifyJS2/blob/master/lib/output.js) | | Lower level access to UglifyJS output. |
72+
| output | An object providing options for UglifyJS [OutputStream](https://github.com/mishoo/UglifyJS2/blob/v2.x/lib/output.js) | | Lower level access to UglifyJS output. |
7373
| comments | boolean, RegExp, function(astNode, comment) -> boolean | Defaults to preserving comments containing `/*!`, `/**!`, `@preserve` or `@license`. | Comment related configuration. |
7474
| extractComments | boolean, RegExp, function (astNode, comment) -> boolean, object | false | Whether comments shall be extracted to a separate file, see below. |
7575
| sourceMap | boolean | false | Use SourceMaps to map error message locations to modules. This slows down the compilation. **Important!** `cheap` source map options don't work with the plugin! |
@@ -81,9 +81,7 @@ This plugin supports UglifyJS features as discussed below:
8181

8282
<h2 align="center">Mangling</h2>
8383

84-
`mangle.props (boolean|object)` - Passing `true` or an object enables and provides options for UglifyJS property mangling - see [UglifyJS documentation](https://github.com/mishoo/UglifyJS2#mangleproperties-options) for mangleProperties for options.
85-
86-
> Note: the UglifyJS docs warn that [you will probably break your source if you use property mangling](https://github.com/mishoo/UglifyJS2#mangling-property-names---mangle-props), so if you aren’t sure why you’d need this feature, you most likely shouldn’t be using it! You can tweak the behavior as below:
84+
`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):
8785

8886
```javascript
8987
new UglifyJsPlugin({
@@ -94,6 +92,20 @@ new UglifyJsPlugin({
9492
})
9593
```
9694

95+
`mangle.props (boolean|object)` - Passing `true` or an object enables and provides options for UglifyJS property mangling - see [UglifyJS documentation](https://github.com/mishoo/UglifyJS2/tree/v2.x#mangleproperties-options) for mangleProperties options.
96+
97+
> Note: the UglifyJS docs warn that [you will probably break your source if you use property mangling](https://github.com/mishoo/UglifyJS2/tree/v2.x#mangling-property-names---mangle-props), so if you aren’t sure why you’d need this feature, you most likely shouldn’t be using it! This is **not** enabled by default.
98+
99+
Example configuration, this will mangle both names and properties:
100+
101+
```javascript
102+
new UglifyJsPlugin({
103+
mangle: {
104+
props: true
105+
}
106+
})
107+
```
108+
97109
<h2 align="center">Extracting Comments</h2>
98110

99111
The `extractComments` option can be

0 commit comments

Comments
 (0)