-
-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
73 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,80 @@ | ||
# babili | ||
|
||
Node API and CLI | ||
|
||
[`babili`](/packages/babili) [![npm](https://img.shields.io/npm/v/babili.svg?maxAge=2592000)](https://www.npmjs.com/package/babili) | ||
|
||
Use `babili` if you don't already use babel (as a preset) or want to run it standalone. Equivalent to using `babel-cli` but only for minification. | ||
Use `babili` if you don't already use babel (as a preset) or want to run it standalone. | ||
|
||
## Installation | ||
|
||
```sh | ||
npm install babili --save-dev | ||
``` | ||
|
||
### Usage | ||
## Usage | ||
|
||
### Node API | ||
|
||
```js | ||
const babili = require("babili"); | ||
|
||
const {code, map} = babili("input code", { | ||
mangle: { | ||
keepClassName: true | ||
} | ||
}); | ||
``` | ||
|
||
### CLI | ||
|
||
```sh | ||
babili input.js --out-file input.min.js --mangle.keepClassName | ||
``` | ||
|
||
## Node API | ||
|
||
```js | ||
const babili = require("babili"); | ||
|
||
babili(input, babiliOptions, overrides) | ||
``` | ||
|
||
### babiliOptions | ||
|
||
Refer [babel-preset-babili options](../babel-preset-babili#options) | ||
|
||
## CLI Options | ||
|
||
``` | ||
babili input.js [options] | ||
``` | ||
|
||
### Simple preset options | ||
|
||
For simple options, use `--optionName` in CLI | ||
|
||
Refer [preset's 1-1 options](../packages/babel-preset-babili#1-1-mapping-with-plugin) for the list of options | ||
|
||
Example: | ||
|
||
``` | ||
babili input.js --mangle false | ||
``` | ||
|
||
### Nested preset options | ||
|
||
Usage: `--optionName.featureName` | ||
|
||
```bash | ||
# global | ||
babili src -d lib | ||
# local | ||
./node_modules/.bin/babili src -d lib | ||
Example: | ||
|
||
```sh | ||
babili input.js --mangle.keepClassName --deadcode.keepFnArgs --outFile input.min.js | ||
``` | ||
|
||
Equivalent to: | ||
`babel src -d lib --presets=babili` | ||
Refer the corresponding plugins to know the list of options it takes | ||
|
||
### IO options | ||
|
||
+ `--out-file path/to/file.min.js`: Output filename. Used only when reading from STDIN / a single input file | ||
+ `--out-dir path/to/dir`: Output Directory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters