diff options
author | iliashk <ilia@tsaver.co.il> | 2016-06-25 11:48:39 +0300 |
---|---|---|
committer | Richard van Velzen <rvanvelzen1@gmail.com> | 2016-06-30 21:45:25 +0200 |
commit | 030611b729af46d2239bd09c95f88e708660f254 (patch) | |
tree | 57fe1149051fdafd01855c24279ca78ac975fe38 | |
parent | 335b72df03fb6593d4bac8ddcde7d1b128eb3c4e (diff) | |
download | tracifyjs-030611b729af46d2239bd09c95f88e708660f254.tar.gz tracifyjs-030611b729af46d2239bd09c95f88e708660f254.zip |
Add Node API documentation for mangling options
-rw-r--r-- | README.md | 29 |
1 files changed, 28 insertions, 1 deletions
@@ -661,7 +661,8 @@ Other options: - `fromString` (default `false`) — if you pass `true` then you can pass JavaScript source code, rather than file names. -- `mangle` — pass `false` to skip mangling names. +- `mangle` (default `true`) — pass `false` to skip mangling names, or pass + an object to specify mangling options (see below). - `mangleProperties` (default `false`) — pass an object to specify custom mangle property options. @@ -680,6 +681,32 @@ Other options: - `except` - pass an array of identifiers that should be excluded from mangling + - `toplevel` — mangle names declared in the toplevel scope (disabled by + default). + + - `eval` — mangle names visible in scopes where eval or with are used + (disabled by default). + + Examples: + + ```javascript + //tst.js + var globalVar; + function funcName(firstLongName, anotherLongName) + { + var myVariable = firstLongName + anotherLongName; + } + + UglifyJS.minify("tst.js").code; + // 'function funcName(a,n){}var globalVar;' + + UglifyJS.minify("tst.js", { mangle: { except: ['firstLongName'] }}).code; + // 'function funcName(firstLongName,a){}var globalVar;' + + UglifyJS.minify("tst.js", { mangle: toplevel: true }}).code; + // 'function n(n,a){}var a;' + ``` + ##### mangleProperties options - `regex` — Pass a RegExp to only mangle certain names (maps to the `--mangle-regex` CLI arguments option) |