Registry / devops / jsmin.js

jsmin.js

JSON →
library1.1.0jsnpmunverified

jsmin.js v1.1.0 is a minimal command-line JavaScript minifier that removes non-essential whitespace, comments, and blank lines while preserving shebangs and strings. Inspired by Crockford's JSMin but implemented in just 34 lines of clever (not clean) JavaScript with no braces '{}' in the source. It is a single-file, zero-dependency CLI tool for file-by-file minification. Slower release cadence, last updated in 2020. Differentiator: extremely compact implementation, but limited to basic transformations and lacks configuration options.

npm install jsmin.js
INSTALL
IMPORT
SIG · JSMIN.JS
J
jsmin.js
devopsjavascriptv1.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

jsmin
✓ npx jsmin.js input.js output.min.js
✗ require('jsmin.js')
jsmin.js is a CLI tool, not a library. There is no JavaScript import or require path. Use via command line or npx.

Minify a JavaScript file using the CLI, output written to .min.js sibling file.

echo 'var x = 1; // comment' > test.js && npx jsmin.js test.js && cat test.min.js
Debug
Known issues
gotchaThe minifier assumes 'use strict'; style and may break code that does not follow strict mode JavaScript.
fix
Ensure all input files use 'use strict'; directives where expected.
affects: >=1.0.0
gotchaNo configuration options: always removes comments and whitespace aggressively, which may break code relying on ASI or line-sensitive patterns.
fix
If you need fine-grained control, consider using a configurable minifier like Terser or UglifyJS.
affects: >=1.0.0
gotchaOutput always overwrites or creates a file with '.min.js' suffix; no dry-run or in-memory mode.
fix
Backup original files before minification.
affects: >=1.0.0
Errors
Common errors & fixes
npx: command not found: jsmin.js
The package is not installed or the name is mistyped.
fix
Run 'npm install -g jsmin.js' or use full path './jsmin.js'.
Error: Cannot find module 'jsmin.js'
Attempting to require() the package as a Node.js module when it is a CLI-only tool.
fix
Use the CLI via npx or global install: npx jsmin.js <file>
SyntaxError: Unexpected token: operator
Input contains JavaScript that does not strictly conform to 'use strict' mode assumptions.
fix
Add 'use strict'; at the top of your file or rewrite code to be strict-mode compatible.
Upgrade
Version history
1.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
5 hits · last 30 days
node
4
Resources
jsmin.js — npm install jsmin.js · libregistry