minor fixes to README.md
This commit is contained in:
23
README.md
23
README.md
@@ -224,7 +224,7 @@ separate step, different from variable name mangling. Pass
|
||||
`--mangle-props`. It will mangle all properties that are seen in some
|
||||
object literal, or that are assigned to. For example:
|
||||
|
||||
```js
|
||||
```javascript
|
||||
var x = {
|
||||
foo: 1
|
||||
};
|
||||
@@ -255,10 +255,10 @@ mangled to the same name in all of them. For this, pass `--name-cache filename.
|
||||
and UglifyJS will maintain these mappings in a file which can then be reused.
|
||||
It should be initially empty. Example:
|
||||
|
||||
```
|
||||
rm -f /tmp/cache.json # start fresh
|
||||
uglifyjs file1.js file2.js --mangle-props --name-cache /tmp/cache.json -o part1.js
|
||||
uglifyjs file3.js file4.js --mangle-props --name-cache /tmp/cache.json -o part2.js
|
||||
```bash
|
||||
$ rm -f /tmp/cache.json # start fresh
|
||||
$ uglifyjs file1.js file2.js --mangle-props --name-cache /tmp/cache.json -o part1.js
|
||||
$ uglifyjs file3.js file4.js --mangle-props --name-cache /tmp/cache.json -o part2.js
|
||||
```
|
||||
|
||||
Now, `part1.js` and `part2.js` will be consistent with each other in terms
|
||||
@@ -273,7 +273,7 @@ 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:
|
||||
|
||||
```
|
||||
```bash
|
||||
$ echo 'var o={"foo":1, bar:3}; o.foo += o.bar; console.log(o.foo);' | uglifyjs --mangle-props keep_quoted -mc
|
||||
var o={foo:1,a:3};o.foo+=o.a,console.log(o.foo);
|
||||
```
|
||||
@@ -350,7 +350,7 @@ console.log(result.code);
|
||||
|
||||
## Minify option structure
|
||||
|
||||
```
|
||||
```javascript
|
||||
{
|
||||
warnings: false,
|
||||
parse: {
|
||||
@@ -577,8 +577,7 @@ Examples:
|
||||
```javascript
|
||||
// test.js
|
||||
var globalVar;
|
||||
function funcName(firstLongName, anotherLongName)
|
||||
{
|
||||
function funcName(firstLongName, anotherLongName) {
|
||||
var myVariable = firstLongName + anotherLongName;
|
||||
}
|
||||
```
|
||||
@@ -737,7 +736,7 @@ using `var` with `reduce_vars` (enabled by default) should suffice.
|
||||
You can also use conditional compilation via the programmatic API. With the difference that the
|
||||
property name is `global_defs` and is a compressor property:
|
||||
|
||||
```js
|
||||
```javascript
|
||||
var result = uglifyJS.minify(fs.readFileSync("input.js", "utf8"), {
|
||||
compress: {
|
||||
dead_code: true,
|
||||
@@ -749,7 +748,7 @@ var result = uglifyJS.minify(fs.readFileSync("input.js", "utf8"), {
|
||||
```
|
||||
|
||||
### Using native Uglify AST with `minify()`
|
||||
```
|
||||
```javascript
|
||||
// example: parse only, produce native Uglify AST
|
||||
|
||||
var result = UglifyJS.minify(code, {
|
||||
@@ -764,7 +763,7 @@ var result = UglifyJS.minify(code, {
|
||||
|
||||
// result.ast contains native Uglify AST
|
||||
```
|
||||
```
|
||||
```javascript
|
||||
// example: accept native Uglify AST input and then compress and mangle
|
||||
// to produce both code and native AST.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user