Added a new SlimItFilter which is an yet another implementation of the jsmin filter. This requires installing the external dependency though (pip install slimit). The rJSmin filter stays the default due to the fact it's only one file and easily shipped as part of compressor.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from __future__ import absolute_import
|
||||
from compressor.filters import CallbackOutputFilter
|
||||
from compressor.filters.jsmin.slimit import SlimItFilter
|
||||
|
||||
class rJSMinFilter(CallbackOutputFilter):
|
||||
callback = "compressor.filters.jsmin.rjsmin.jsmin"
|
||||
|
10
compressor/filters/jsmin/slimit.py
Normal file
10
compressor/filters/jsmin/slimit.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from __future__ import absolute_import
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from compressor.filters import CallbackOutputFilter
|
||||
|
||||
class SlimItFilter(CallbackOutputFilter):
|
||||
dependencies = ["slimit"]
|
||||
callback = "slimit.minify"
|
||||
kwargs = {
|
||||
"mangle": True,
|
||||
}
|
@@ -12,6 +12,13 @@ HEAD
|
||||
|
||||
- Documented included filters.
|
||||
|
||||
- Added `Slim It`_ filter.
|
||||
|
||||
- Added new CallbackOutputFilter to ease the implementation of Python-based
|
||||
callback filters that only need to pass the content to a callable.
|
||||
|
||||
.. _`Slim It`: http://slimit.org/
|
||||
|
||||
0.9.2
|
||||
-----
|
||||
|
||||
|
@@ -58,7 +58,16 @@ for the :ref:`parser <compress_parser>` ``compressor.parser.Html5LibParser``::
|
||||
|
||||
pip install html5lib
|
||||
|
||||
`Slim It`_ (optional)
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
for the :ref:`Slim It filter <slimit_filter>` ``compressor.filters.jsmin.SlimItFilter``::
|
||||
|
||||
pip install slimit
|
||||
|
||||
|
||||
.. _BeautifulSoup: http://www.crummy.com/software/BeautifulSoup/
|
||||
.. _lxml: http://codespeak.net/lxml/
|
||||
.. _libxml2: http://xmlsoft.org/
|
||||
.. _html5lib: http://code.google.com/p/html5lib/
|
||||
.. _`Slim It`: http://slimit.org/
|
||||
|
@@ -133,6 +133,13 @@ A list of filters that will be applied to javascript. Possible options are:
|
||||
|
||||
A filter that uses the jsmin implementation rJSmin_ to compress JavaScript code.
|
||||
|
||||
.. _slimit_filter:
|
||||
|
||||
``compressor.filters.jsmin.SlimItFilter``
|
||||
"""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
A filter that uses the jsmin implementation `Slim It`_ to compress JavaScript code.
|
||||
|
||||
``compressor.filters.closure.ClosureCompilerFilter``
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
@@ -154,6 +161,7 @@ A filter that passes the JavaScript code to the `YUI compressor`_.
|
||||
.. _rJSmin: http://opensource.perlig.de/rjsmin/
|
||||
.. _`Google Closure compiler`: http://code.google.com/closure/compiler/
|
||||
.. _`YUI compressor`: http://developer.yahoo.com/yui/compressor/
|
||||
.. _`Slim It`: http://slimit.org/
|
||||
|
||||
.. _compress_precompilers:
|
||||
|
||||
|
Reference in New Issue
Block a user