Skip to main content

JavaScript minifier. PLEASE UPDATE TO VERSION >= 2.0.6. Older versions have a serious bug related to comments.

Project description

JavaScript minifier.


from jsmin import jsmin
with open('myfile.js') as js_file:
    minified = jsmin(

You can run it as a commandline tool also:

python -m jsmin myfile.js

As yet, jsmin makes no attempt to be compatible with ECMAScript 6 / / Harmony. If you’re using it on Harmony code, though, you might find the quote_chars parameter useful:

from jsmin import jsmin
with open('myfile.js') as js_file:
    minified = jsmin(, quote_chars="'\"`")

Where to get it


Issues and Pull requests will be gratefully received on Bitbucket. Pull requests on github are great too, but the issue tracker lives on bitbucket.

If possible, please make separate pull requests for tests and for code: tests will be committed on the stable branch (which tracks the latest released version) while code will go to default by, erm, default.

Unless you request otherwise, your Bitbucket identity will be added to the contributor’s list below; if you prefer a different name feel free to add it in your pull request instead. (If you prefer not to be mentioned you’ll have to let the maintainer know somehow.)

Build/test status

Both default and stable branches are tested with Travis:

Stable (latest released version plus any new tests) is tested against CPython 2.6, 2.7, 3.2, and 3.3. Currently:

If stable is failing that means there’s a new test that fails on the latest released version on pypi, with no fix yet released.

Default (development version, might be ahead of latest released version) is tested against CPython 2.6, 2.7, 3.2, and 3.3. Currently:

If default is failing don’t use it, but as long as stable is passing the pypi release should be ok.

Contributors (chronological commit order)


v2.1.1 (2015-02-14) Tikitu de Jager

  • Fix #16: bug returning a literal regex containing escaped forward-slashes.

v2.1.0 (2014-12-24) Tikitu de Jager

  • First changelog entries; see README.rst for prior contributors.
  • Expose quote_chars parameter to provide just enough unofficial Harmony support to be useful.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for jsmin, version 2.1.1
Filename, size File type Python version Upload date Hashes
Filename, size jsmin-2.1.1.tar.gz (9.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page