minify-js

Extremely fast JavaScript minifier, written in Rust.

Goals

Performance

Comparison with esbuild, run on common libraries.

Chart showing speed of JS minifiersChart showing compression of JS minifiers

Features

Usage

CLI

Precompiled binaries are available for Linux, macOS, and Windows.

Linux x64 | macOS x64 | Windows x64

Use the --help argument for more details.

bash minify-js --output /path/to/output.min.js /path/to/src.js

Rust

Add the dependency:

toml [dependencies] minify-js = "0.2.11"

Call the method:

```rust use minify_js::minify;

let mut code: &[u8] = b"let x = 1;"; let mut out = Vec::new(); minify(code.tovec(), &mut out).unwrap(); asserteq!(out.as_slice(), b"let x=1"); ```

Node.js

Install the dependency:

bash npm i @minify-js/node

Call the method:

```typescript import {minify} from "@minify-js/node";

const src = Buffer.from("let x = 1;", "utf-8"); const min = minify(src); ```

In progress

Textual compression