Skip to content

Products / Developer tools

mni

mni is a Rust command-line minifier built on SWC for JavaScript and LightningCSS for CSS, with JSON support through serde_json. It auto-detects the file format and offers dev, prod and aggressive presets.

GitHub Talk to usRustCLIOpen source
Install
cargo install mni
3
Formats: JavaScript, CSS, JSON
3
Presets

Features

Built for production

01

Built on SWC and LightningCSS

Uses SWC for JavaScript (ES5 to ESNext) and LightningCSS for CSS.

02

Safe by default

Conservative optimizations intended to avoid producing invalid code.

03

Multi-format

JavaScript, CSS and JSON in one tool.

04

Smart detection

File format is detected automatically, with a CLI that offers presets.

05

Source maps

Optional source map generation for debugging.

In code

See it work

Basic usage
mni input.js -o output.min.js
mni styles.css -o styles.min.css
mni data.json -o data.min.json
mni input.js --stats
Presets
mni input.js --preset dev
mni input.js --preset prod
mni input.js --preset aggressive

Presets

- `dev`: fast, readable output with source maps - `prod`: balanced compression and speed - `aggressive`: maximum compression

Optimization techniques

JavaScript (SWC): identifier mangling, dead code elimination, constant folding, scope hoisting and arrow function optimization.

CSS (LightningCSS): color minification, length optimization, property merging, vendor prefix optimization and calc() optimization.

JSON (serde_json): whitespace removal, key ordering and UTF-8 optimization.

Putting mni to work?

We help teams design, build and operate production systems on this stack.