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 rjsminVerified import paths — ran on the pinned version, not inferred.
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.
Ensure your JavaScript code is syntactically correct and well-formed before passing it to rjsmin. Use linters or validate the code beforehand.
Read the entire JavaScript file content into a string before passing it to the `jsmin` function.
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.
pip install rjsmin
rjsmin.jsmin(javascript_string)
rjsmin.jsmin("var some_js = 'value';")No dependency data recorded yet.