4 Summary: JavaScript minifier.
5 Home-page: https://github.com/tikitu/jsmin/
6 Author: Dave St.Germain
7 Author-email: dave@st.germa.in
8 Maintainer: Tikitu de Jager
9 Maintainer-email: tikitu+jsmin@logophile.org
22 from jsmin import jsmin
23 with open('myfile.js') as js_file:
24 minified = jsmin(js_file.read())
26 You can run it as a commandline tool also::
28 python -m jsmin myfile.js
30 NB: ``jsmin`` makes no attempt to be compatible with
31 `ECMAScript 6 / ES.next / Harmony <http://wiki.ecmascript.org/doku.php?id=harmony:specification_drafts>`_.
32 The current maintainer does not intend to add ES6-compatibility. If you would
33 like to take over maintenance and update ``jsmin`` for ES6, please contact
34 `Tikitu de Jager <mailto:tikitu+jsmin@logophile.org>`_. Pull requests are also
35 welcome, of course, but my time to review them is somewhat limited these days.
37 If you're using ``jsmin`` on ES6 code, though, you might find the ``quote_chars``
42 from jsmin import jsmin
43 with open('myfile.js') as js_file:
44 minified = jsmin(js_file.read(), quote_chars="'\"`")
50 * install the package `from pypi <https://pypi.python.org/pypi/jsmin/>`_
51 * get the latest release `from latest-release on github <https://github.com/tikitu/jsmin/tree/latest-release/jsmin>`_
52 * get the development version `from master on github <https://github.com/tikitu/jsmin/>`_
55 Python 2 support removed
56 ========================
58 Python 2 support was removed in version 3.0.0. If you need to support Python 2, please use version 2.2.2 with setuptools<58.
63 `Issues <https://github.com/tikitu/jsmin/issues>`_ and `Pull requests <https://github.com/tikitu/jsmin/pulls>`_
64 will be gratefully received on Github. The project used to be hosted
65 `on bitbucket <https://bitbucket.org/dcs/jsmin/>`_ and old issues can still be
68 If possible, please make separate pull requests for tests and for code: tests will be added to the `latest-release` branch while code will go to `master`.
70 Unless you request otherwise, your Github identity will be added to the contributor's list below; if you prefer a
71 different name feel free to add it in your pull request instead. (If you prefer not to be mentioned you'll have to let
72 the maintainer know somehow.)
77 Both branches are tested with Travis: https://travis-ci.org/tikitu/jsmin
79 The `latest-release` branch (the version on PyPI plus any new tests) is tested against CPython 3.
82 .. image:: https://travis-ci.org/tikitu/jsmin.png?branch=latest-release
84 If that branch is failing that means there's a new test that fails on *the latest released version on pypi*, with no fix yet
87 The `master` branch (development version, might be ahead of latest released version) is tested against CPython 3.
90 .. image:: https://travis-ci.org/tikitu/jsmin.png?branch=master
92 If `master` is failing don't use it, but as long as `latest-release` is passing the pypi release should be ok.
94 Contributors (chronological commit order)
95 =========================================
97 * `Dave St.Germain <https://bitbucket.org/dcs>`_ (original author)
98 * `Hans weltar <https://bitbucket.org/hansweltar>`_
99 * `Tikitu de Jager <mailto:tikitu+jsmin@logophile.org>`_ (current maintainer)
100 * https://bitbucket.org/rennat
101 * `Nick Alexander <https://bitbucket.org/ncalexan>`_
102 * `Gennady Kovshenin <https://github.com/soulseekah>`_
103 * `Matt Molyneaux <https://github.com/moggers87>`_
104 * `Albert Wang <https://github.com/albertyw>`_
105 * `Ben Bradshaw <https://github.com/serenecloud>`_
110 v3.0.0 (2021-09-08) Ben Bradshaw
111 --------------------------------
113 - Breaking Change: Removed support for Python 2
115 - Removed usage of use_2to3 in setup.py
117 v2.2.2 (2017-05-01) Tikitu de Jager
118 -----------------------------------
120 - Add license headers to code files (fixes i#17)
122 - Remove mercurial files (fixes #20)
124 v2.2.1 (2016-03-06) Tikitu de Jager
125 -----------------------------------
127 - Fix #14: Infinite loop on `return x / 1;`
129 v2.2.0 (2015-12-19) Tikitu de Jager
130 -----------------------------------
132 - Merge #13: Preserve "loud comments" starting with `/*!`
134 These are commonly used for copyright notices, and are preserved by various
135 other minifiers (e.g. YUI Compressor).
137 v2.1.6 (2015-10-14) Tikitu de Jager
138 -----------------------------------
140 - Fix #12: Newline following a regex literal should not be elided.
142 v2.1.5 (2015-10-11) Tikitu de Jager
143 -----------------------------------
145 - Fix #9: Premature end of statement caused by multi-line comment not
148 - Fix #10: Removing multiline comment separating tokens must leave a space.
150 - Refactor comment handling for maintainability.
152 v2.1.4 (2015-08-23) Tikitu de Jager
153 -----------------------------------
155 - Fix #6: regex literal matching comment was not correctly matched.
157 - Refactor regex literal handling for robustness.
159 v2.1.3 (2015-08-09) Tikitu de Jager
160 -----------------------------------
162 - Reset issue numbering: issues live in github from now on.
164 - Fix #1: regex literal was not recognised when occurring directly after `{`.
166 v2.1.2 (2015-07-12) Tikitu de Jager
167 -----------------------------------
169 - Issue numbers here and below refer to the bitbucket repository.
171 - Fix #17: bug when JS starts with comment then literal regex.
173 v2.1.1 (2015-02-14) Tikitu de Jager
174 -----------------------------------
176 - Fix #16: bug returning a literal regex containing escaped forward-slashes.
178 v2.1.0 (2014-12-24) Tikitu de Jager
179 -----------------------------------
181 - First changelog entries; see README.rst for prior contributors.
183 - Expose quote_chars parameter to provide just enough unofficial Harmony
184 support to be useful.
188 Classifier: Development Status :: 5 - Production/Stable
189 Classifier: Environment :: Web Environment
190 Classifier: Intended Audience :: Developers
191 Classifier: License :: OSI Approved :: MIT License
192 Classifier: Operating System :: OS Independent
193 Classifier: Programming Language :: Python :: 3 :: Only
194 Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
195 Classifier: Topic :: Software Development :: Pre-processors
196 Classifier: Topic :: Text Processing :: Filters