JavaScript Minifier
Compact JavaScript by stripping comments and collapsing safe whitespace — with strings, template literals, and regex literals preserved exactly. Runs in your browser, no upload.
Tóm tắt công cụ
Công cụ này nhận đầu vào có cấu trúc và trả về đầu ra xác định ngay trong trình duyệt, không tải lên máy chủ.
- Tên công cụ
- JavaScript Minifier
- Mục đích đầu vào
- Cung cấp nội dung nguồn để biến đổi, xác thực hoặc phân tích.
- Mục đích đầu ra
- Nhận đầu ra chuẩn hóa thuận tiện để sao chép, tái sử dụng hoặc gỡ lỗi.
- Đầu vào ví dụ
- // say hi function hi(name) { return `Hello, ${name}!`; }
- Đầu ra ví dụ
- function hi(name){return `Hello, ${name}!`;}
Giới thiệu công cụ
Compact JavaScript by stripping comments and collapsing safe whitespace — with strings, template literals, and regex literals preserved exactly. Runs in your browser, no upload.
Tổng quan công cụ
This is a lightweight, conservative JavaScript minifier. It walks your source one token at a time, leaving every string, template literal, and regular expression untouched while removing line and block comments and shrinking runs of whitespace where it is safe to do so. It does not rename identifiers, shorten property accesses, or perform tree-shaking — for that you want a full bundler. What it does well is compressing snippets, examples, inline scripts, and configuration code without changing their behavior.
Trường hợp sử dụng
- Inline a small snippet into HTML where every byte matters.
- Quickly minify a code sample for a documentation page or blog post.
- Pre-process configuration scripts before piping them into a CMS field.
Ví dụ đầu vào/đầu ra
// say hi
function hi(name) {
return `Hello, ${name}!`;
}function hi(name){return `Hello, ${name}!`;}Câu hỏi thường gặp
Does it rename variables (mangle)?+
Will it break template literals or regex?+
Is automatic semicolon insertion (ASI) handled?+
Khám phá thêm công cụ
Khám phá các tiện ích liên quan trong danh mục Lập trình viên bên dưới.
Công cụ liên quan
Tiện ích được tuyển chọn có thể hữu ích cho bạn