| 1 |
===== |
| 2 |
jsmin |
| 3 |
===== |
| 4 |
|
| 5 |
JavaScript minifier. |
| 6 |
|
| 7 |
Usage |
| 8 |
===== |
| 9 |
|
| 10 |
.. code:: python |
| 11 |
|
| 12 |
from jsmin import jsmin |
| 13 |
with open('myfile.js') as js_file: |
| 14 |
minified = jsmin(js_file.read()) |
| 15 |
|
| 16 |
You can run it as a commandline tool also:: |
| 17 |
|
| 18 |
python -m jsmin myfile.js |
| 19 |
|
| 20 |
NB: ``jsmin`` makes no attempt to be compatible with |
| 21 |
`ECMAScript 6 / ES.next / Harmony <http://wiki.ecmascript.org/doku.php?id=harmony:specification_drafts>`_. |
| 22 |
The current maintainer does not intend to add ES6-compatibility. If you would |
| 23 |
like to take over maintenance and update ``jsmin`` for ES6, please contact |
| 24 |
`Tikitu de Jager <mailto:[email protected]>`_. Pull requests are also |
| 25 |
welcome, of course, but my time to review them is somewhat limited these days. |
| 26 |
|
| 27 |
If you're using ``jsmin`` on ES6 code, though, you might find the ``quote_chars`` |
| 28 |
parameter useful: |
| 29 |
|
| 30 |
.. code:: python |
| 31 |
|
| 32 |
from jsmin import jsmin |
| 33 |
with open('myfile.js') as js_file: |
| 34 |
minified = jsmin(js_file.read(), quote_chars="'\"`") |
| 35 |
|
| 36 |
|
| 37 |
Where to get it |
| 38 |
=============== |
| 39 |
|
| 40 |
* install the package `from pypi <https://pypi.python.org/pypi/jsmin/>`_ |
| 41 |
* get the latest release `from latest-release on github <https://github.com/tikitu/jsmin/tree/latest-release/jsmin>`_ |
| 42 |
* get the development version `from master on github <https://github.com/tikitu/jsmin/>`_ |
| 43 |
|
| 44 |
|
| 45 |
Python 2 support removed |
| 46 |
======================== |
| 47 |
|
| 48 |
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. |
| 49 |
|
| 50 |
Contributing |
| 51 |
============ |
| 52 |
|
| 53 |
`Issues <https://github.com/tikitu/jsmin/issues>`_ and `Pull requests <https://github.com/tikitu/jsmin/pulls>`_ |
| 54 |
will be gratefully received on Github. The project used to be hosted |
| 55 |
`on bitbucket <https://bitbucket.org/dcs/jsmin/>`_ and old issues can still be |
| 56 |
found there. |
| 57 |
|
| 58 |
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`. |
| 59 |
|
| 60 |
Unless you request otherwise, your Github identity will be added to the contributor's list below; if you prefer a |
| 61 |
different name feel free to add it in your pull request instead. (If you prefer not to be mentioned you'll have to let |
| 62 |
the maintainer know somehow.) |
| 63 |
|
| 64 |
Build/test status |
| 65 |
================= |
| 66 |
|
| 67 |
Both branches are tested with Travis: https://travis-ci.org/tikitu/jsmin |
| 68 |
|
| 69 |
The `latest-release` branch (the version on PyPI plus any new tests) is tested against CPython 3. |
| 70 |
Currently: |
| 71 |
|
| 72 |
.. image:: https://travis-ci.org/tikitu/jsmin.png?branch=latest-release |
| 73 |
|
| 74 |
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 |
| 75 |
released. |
| 76 |
|
| 77 |
The `master` branch (development version, might be ahead of latest released version) is tested against CPython 3. |
| 78 |
Currently: |
| 79 |
|
| 80 |
.. image:: https://travis-ci.org/tikitu/jsmin.png?branch=master |
| 81 |
|
| 82 |
If `master` is failing don't use it, but as long as `latest-release` is passing the pypi release should be ok. |
| 83 |
|
| 84 |
Contributors (chronological commit order) |
| 85 |
========================================= |
| 86 |
|
| 87 |
* `Dave St.Germain <https://bitbucket.org/dcs>`_ (original author) |
| 88 |
* `Hans weltar <https://bitbucket.org/hansweltar>`_ |
| 89 |
* `Tikitu de Jager <mailto:[email protected]>`_ (current maintainer) |
| 90 |
* https://bitbucket.org/rennat |
| 91 |
* `Nick Alexander <https://bitbucket.org/ncalexan>`_ |
| 92 |
* `Gennady Kovshenin <https://github.com/soulseekah>`_ |
| 93 |
* `Matt Molyneaux <https://github.com/moggers87>`_ |
| 94 |
* `Albert Wang <https://github.com/albertyw>`_ |
| 95 |
* `Ben Bradshaw <https://github.com/serenecloud>`_ |