Skip to content

Commit

Permalink
more refinement of minify() documentation (#1983)
Browse files Browse the repository at this point in the history
  • Loading branch information
kzc authored and alexlamsl committed May 20, 2017
1 parent d3c4a8e commit a1dedeb
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,17 +301,20 @@ like this:
var UglifyJS = require("uglify-js");
```

There is a single high level minification function, `minify(code, options)`, which will
performs all the steps in a configurable manner.
Example:
There is a single high level function, **`minify(code, options)`**,
which will perform all minification [phases](#minify-options) in a configurable
manner. By default `minify()` will enable the options [`compress`](#compress-options)
and [`mangle`](#mangle-options). Example:
```javascript
var code = "function add(first, second) { return first + second; }";
var result = UglifyJS.minify(code);
console.log(result.error); // runtime error, or `undefined` if no error
console.log(result.code); // minified output: function add(n,d){return n+d}
```

You can also compress multiple files:
You can `minify` more than one JavaScript file at a time by using an object
for the first argument where the keys are file names and the values are source
code:
```javascript
var code = {
"file1.js": "function add(first, second) { return first + second; }",
Expand Down

0 comments on commit a1dedeb

Please sign in to comment.