Skip to content

Commit

Permalink
Add note about name mangling when using --mangle-props=unquoted (#1314)
Browse files Browse the repository at this point in the history
  • Loading branch information
wiktor-k authored and rvanvelzen committed Jan 19, 2017
1 parent 5c7705f commit 0913db8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,17 @@ of mangled property names.
Using the name cache is not necessary if you compress all your files in a
single call to UglifyJS.

#### Mangling unquoted names (`--mangle-props=unquoted` or `--mangle-props=2`)

Using quoted property name (`o["foo"]`) reserves the property name (`foo`)
so that it is not mangled throughout the entire script even when used in an
unquoted style (`o.foo`). Example:

```
$ echo 'var o={"foo":1, bar:3}; o.foo += o.bar; console.log(o.foo);' | uglifyjs --mangle-props=2 -mc
var o={"foo":1,a:3};o.foo+=o.a,console.log(o.foo);
```

#### Debugging property name mangling

You can also pass `--mangle-props-debug` in order to mangle property names
Expand Down

0 comments on commit 0913db8

Please sign in to comment.