Registry / devops / rjsmin

rjsmin

JSON →
library1.2.5pypypi✓ verified 28d ago

rJSmin is a javascript minifier written in Python, based on the semantics of jsmin.c by Douglas Crockford. It is a re-implementation aiming for speed, designed for runtime use rather than a preprocessing step, and usually produces the same results as the original `jsmin.c`. The current version is 1.2.5 and it supports Python 2.7 and 3.6+.

pip install rjsmin
INSTALL
IMPORT
SIG · RJSMIN
R
rjsmin
devopspythonv1.2.5
Install
1.6s avg
Import
—
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v1.2.5 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.9MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 1.6s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

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

jsmin
✓ from rjsmin import jsmin

The `jsmin` function takes a string containing JavaScript code and returns its minified version as a string. An optional `keep_bang_comments` parameter allows preserving comments starting with an exclamation mark.

from rjsmin import jsmin js_code = """\ function hello( name ) { /* a comment */ return 'Hello, ' + name + '!'; } """ minified_code = jsmin(js_code) print(minified_code) # Expected output: function hello(name){return'Hello,'+name+'!'}
rjsmin --version
Debug
Known issues
gotcharJSmin performs no error detection. Unterminated string, regex, and comment literals are treated as regular JavaScript code and minified as such, which can lead to invalid output without explicit error messages.
fix
Ensure your JavaScript code is syntactically correct and well-formed before passing it to rjsmin. Use linters or validate the code beforehand.
affects: All versions
gotcharJSmin does not handle streams and requires the complete JavaScript code as a single string input. It cannot process code incrementally from a file stream.
fix
Read the entire JavaScript file content into a string before passing it to the `jsmin` function.
affects: All versions
gotchaWhile generally compatible with jsmin.c, rJSmin has subtle behavioral differences. For example, control characters in string/regex literals are untouched, newlines are generally disallowed in string/regex literals (except for ECMA-5 line continuations), and sequences like '+ +' or '- -' are not collapsed to '++' or '--'.
fix
Thoroughly test minified output if exact byte-for-byte compatibility or specific minification behaviors (beyond simple whitespace removal) with the original jsmin.c are critical for your application.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'rjsmin'
The rjsmin package is not installed in the current Python environment.
fix
pip install rjsmin
TypeError: module 'rjsmin' is not callable
The user is attempting to call the rjsmin module directly, rather than its primary minification function.
fix
rjsmin.jsmin(javascript_string)
TypeError: expected string or buffer, <class 'list'> found
The rjsmin.jsmin function expects the input JavaScript code to be a string or a file-like object, but received an unsupported type.
fix
rjsmin.jsmin("var some_js = 'value';")
Upgrade
Version history
1.2.5latest on PyPI · released Oct 12, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
3 hits · last 30 days
node
2
Resources
rjsmin — pip install rjsmin · libregistry