| Crates.io | minify-js |
| lib.rs | minify-js |
| version | 0.6.0 |
| created_at | 2022-06-18 16:24:54.645525+00 |
| updated_at | 2023-12-25 03:29:56.425263+00 |
| description | Extremely fast JavaScript minifier |
| homepage | https://github.com/wilsonzlin/minify-js |
| repository | https://github.com/wilsonzlin/minify-js |
| max_upload_size | |
| id | 608600 |
| size | 114,482 |
Extremely fast JavaScript minifier, written in Rust.
Comparison with esbuild, run on common libraries.
new, this, arguments, and prototype aren't used.if statements to expressions.Precompiled binaries are available for Linux, macOS, and Windows.
Linux x64 | macOS x64 | Windows x64
Use the --help argument for more details.
minify-js --output /path/to/output.min.js /path/to/src.js
Add the dependency:
[dependencies]
minify-js = "0.6.0"
Call the method:
use minify_js::{Session, TopLevelMode, minify};
let mut code: &[u8] = b"const main = () => { let my_first_variable = 1; };";
let session = Session::new();
let mut out = Vec::new();
minify(&session, TopLevelMode::Global, code, &mut out).unwrap();
assert_eq!(out.as_slice(), b"const main=()=>{let a=1}");
Install the dependency:
npm i @minify-js/node
Call the method:
import {minify} from "@minify-js/node";
const src = Buffer.from("let x = 1;", "utf-8");
const min = minify(src);
import { "a-b" as "c-d" } from "x".x === null || x === undefined with x == null, where x is side-effect free.typeof x === "undefined" with x === undefined.void x with x, undefined.return undefined with return.const with let.let and const.if (...) return a; else if (...) return b; else return c => return (...) ? a : (...) ? b : c.