Home | History | Annotate | Download | only in jsmin
      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:tikitu+jsmin (a] logophile.org>`_. 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 Contributing
     45 ============
     46 
     47 `Issues <https://github.com/tikitu/jsmin/issues>`_ and `Pull requests <https://github.com/tikitu/jsmin/pulls>`_
     48 will be gratefully received on Github. The project used to be hosted
     49 `on bitbucket <https://bitbucket.org/dcs/jsmin/>`_ and old issues can still be
     50 found there.
     51 
     52 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`.
     53 
     54 Unless you request otherwise, your Github identity will be added to the contributor's list below; if you prefer a
     55 different name feel free to add it in your pull request instead. (If you prefer not to be mentioned you'll have to let
     56 the maintainer know somehow.)
     57 
     58 Build/test status
     59 =================
     60 
     61 Both branches are tested with Travis: https://travis-ci.org/tikitu/jsmin
     62 
     63 The `latest-release` branch (the version on PyPI plus any new tests) is tested against CPython 2.6, 2.7, 3.2, and 3.3.
     64 Currently:
     65 
     66 .. image:: https://travis-ci.org/tikitu/jsmin.png?branch=latest-release
     67 
     68 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
     69 released.
     70 
     71 The `master` branch (development version, might be ahead of latest released version) is tested against CPython 2.6, 2.7, 3.2, and
     72 3.3. Currently:
     73 
     74 .. image:: https://travis-ci.org/tikitu/jsmin.png?branch=master
     75 
     76 If `master` is failing don't use it, but as long as `latest-release` is passing the pypi release should be ok.
     77 
     78 Contributors (chronological commit order)
     79 =========================================
     80 
     81 * `Dave St.Germain <https://bitbucket.org/dcs>`_ (original author)
     82 * `Hans weltar <https://bitbucket.org/hansweltar>`_
     83 * `Tikitu de Jager <mailto:tikitu+jsmin (a] logophile.org>`_ (current maintainer)
     84 * https://bitbucket.org/rennat
     85 * `Nick Alexander <https://bitbucket.org/ncalexan>`_
     86 * `Gennady Kovshenin <https://github.com/soulseekah>`_
     87 * `Matt Molyneaux <https://github.com/moggers87>`_
     88