Skip to main content

JavaScript minifier.

Usage

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

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 / ES.next / 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(js_file.read(), quote_chars="'\"`")

Where to get it

Contributing

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: https://travis-ci.org/tikitu/jsmin

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

https://travis-ci.org/tikitu/jsmin.png?branch=ghstable

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:

https://travis-ci.org/tikitu/jsmin.png?branch=master

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)

Changelog

v2.1.2 (2015-07-12) Tikitu de Jager

  • Fix #17: bug when JS starts with comment then literal regex.

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.

Metadata

Release files for jsmin 2.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jsmin 2.1.2
File Size Uploaded
jsmin-2.1.2.tar.gz 10.0 kB Details

Release files / jsmin-2.1.2.tar.gz

Download URL jsmin-2.1.2.tar.gz
Size 10.0 kB
Tags Source
SHA-256 checksum
How to use checksums
5e710e9db14f210dfd55ebec43bca5c812d34c5b6179dbcba2e61d9f965bf4e1
BLAKE2b-256 checksum
How to use checksums
56b0700a7ffb7c67530e8f99e43c91343e9f4ed0ded87a0f39b961375113ff6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

3.0.1

1 release file

3.0.0

1 release file

2.2.2

1 release file

2.2.1

1 release file

2.2.0

1 release file

2.1.6

1 release file

2.1.5

1 release file

2.1.4

1 release file

2.1.3

1 release file

This release

2.1.2 This release

1 release file

2.1.1

1 release file

2.1.0

1 release file

2.0.11

1 release file

2.0.10

1 release file

2.0.9

1 release file

2.0.8

1 release file

2.0.7

1 release file

2.0.6

5 release files

2.0.5

5 release files

2.0.3

4 release files

2.0.2

4 release files

2.0.1

1 release file

2.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page