# babel-minify

> ✂️ An ES6+ aware minifier based on the Babel toolchain (beta)

Latest version **0.5.2** (published 2022-05-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install babel-minify
pnpm add babel-minify
yarn add babel-minify
bun add babel-minify
```

Provides the commands `minify`, `babel-minify`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.5.2 |
| Published | 2022-05-06 |
| First published | 2016-06-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 24.7 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 4364 |
| Author | amasad |
| Maintainers | nicolo-ribaudo, boopathi, hzoo, vignesh.shanmugam, loganfsmyth |
| Keywords | babel-minify, babel-preset, minify |

## Links

- npm: https://www.npmjs.com/package/babel-minify
- Repository: https://github.com/babel/minify/tree/master/packages/babel-minify
- Homepage: https://github.com/babel/minify#readme
- Issues: https://github.com/babel/minify/issues
- npm.io page: https://npm.io/package/babel-minify

## Dependencies (7)

- [lodash](https://npm.io/package/lodash.md) ^4.17.11
- [mkdirp](https://npm.io/package/mkdirp.md) ^0.5.1
- [@babel/core](https://npm.io/package/@babel/core.md) ^7.1.0
- [yargs-parser](https://npm.io/package/yargs-parser.md) ^10.0.0
- [util.promisify](https://npm.io/package/util.promisify.md) ^1.0.0
- [babel-preset-minify](https://npm.io/package/babel-preset-minify.md) ^0.5.2
- [fs-readdir-recursive](https://npm.io/package/fs-readdir-recursive.md) ^1.1.0

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.5.2 (latest) — 2022-05-06
- 0.6.0-alpha.9 (canary) — 2019-08-15
- 0.5.1 — 2019-08-15
- 0.6.0-alpha.8 — 2019-08-15
- 0.6.0-alpha.5 — 2018-10-29
- 0.6.0-alpha.4 — 2018-10-29
- 0.5.0 — 2018-09-24
- 0.5.0-alpha.9 — 2018-09-23
- 0.5.0-alpha.3cc09dcf — 2018-07-27
- 0.5.0-alpha.beb87b9a — 2018-07-26
- 0.5.0-alpha.5a128fd5 — 2018-07-17
- 0.5.0-alpha.2ed85317 — 2018-07-17
- 0.5.0-alpha.a24dd066 — 2018-06-11
- 0.5.0-alpha.2e0de171 — 2018-06-01
- 0.5.0-alpha.89fc69da — 2018-06-01
- … 82 more at https://npm.io/package/babel-minify/versions

## README

# babel-minify

Node API and CLI

[![npm](https://img.shields.io/npm/v/babel-minify.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-minify)

Use `babel-minify` if you don't already use babel (as a preset) or want to run it standalone.

## Installation

```sh
npm install babel-minify --save-dev
```

## Usage

### Node API

```js
const minify = require("babel-minify");

const {code, map} = minify("input code", {
  mangle: {
    keepClassName: true
  }
});
```

### CLI

```sh
minify input.js --out-file input.min.js --mangle.keepClassName
```

## Node API

```js
const minify = require("babel-minify");

minify(input, minifyOptions, overrides)
```

### minifyOptions

Refer [babel-preset-minify options](https://github.com/babel/minify/tree/master/packages/babel-preset-minify#options)

### overrides

+ `babel`: Custom babel
+ `minifyPreset`: Custom minify preset
+ `inputSourceMap`: Input Sourcemap
+ `sourceMaps`: [Boolean]
+ `comments`: [Function | RegExp | Boolean]

## CLI Options

```
minify input.js [options]
```

### Simple preset options

For simple options, use `--optionName` in CLI

Refer [preset's 1-1 options](https://github.com/babel/minify/tree/master/packages/babel-preset-minify#1-1-mapping-with-plugin) for the list of options

Example:

```
minify input.js --mangle false
```

### Nested preset options

Usage: `--optionName.featureName`

Example:

```sh
minify input.js --mangle.keepClassName --deadcode.keepFnArgs --outFile input.min.js
```

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.

---
_Source: https://npm.io/package/babel-minify · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
