Support for clean-css (https://github.com/GoalSmashers/clean-css/)
This commit is contained in:
@@ -45,6 +45,8 @@ class CompressorConf(AppConf):
|
|||||||
YUGLIFY_BINARY = 'yuglify'
|
YUGLIFY_BINARY = 'yuglify'
|
||||||
YUGLIFY_CSS_ARGUMENTS = '--terminal'
|
YUGLIFY_CSS_ARGUMENTS = '--terminal'
|
||||||
YUGLIFY_JS_ARGUMENTS = '--terminal'
|
YUGLIFY_JS_ARGUMENTS = '--terminal'
|
||||||
|
CLEAN_CSS_BINARY = 'cleancss'
|
||||||
|
CLEAN_CSS_ARGUMENTS = ''
|
||||||
DATA_URI_MAX_SIZE = 1024
|
DATA_URI_MAX_SIZE = 1024
|
||||||
|
|
||||||
# the cache backend to use
|
# the cache backend to use
|
||||||
|
|||||||
10
compressor/filters/cleancss.py
Normal file
10
compressor/filters/cleancss.py
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
from compressor.conf import settings
|
||||||
|
from compressor.filters import CompilerFilter
|
||||||
|
|
||||||
|
|
||||||
|
class CleanCSSFilter(CompilerFilter):
|
||||||
|
command = "{binary} {args} -o {outfile} {infile}"
|
||||||
|
options = (
|
||||||
|
("binary", settings.COMPRESS_CLEAN_CSS_BINARY),
|
||||||
|
("args", settings.COMPRESS_CLEAN_CSS_ARGUMENTS),
|
||||||
|
)
|
||||||
@@ -22,6 +22,7 @@ from compressor.filters.closure import ClosureCompilerFilter
|
|||||||
from compressor.filters.csstidy import CSSTidyFilter
|
from compressor.filters.csstidy import CSSTidyFilter
|
||||||
from compressor.filters.yuglify import YUglifyCSSFilter, YUglifyJSFilter
|
from compressor.filters.yuglify import YUglifyCSSFilter, YUglifyJSFilter
|
||||||
from compressor.filters.yui import YUICSSFilter, YUIJSFilter
|
from compressor.filters.yui import YUICSSFilter, YUIJSFilter
|
||||||
|
from compressor.filters.cleancss import CleanCSSFilter
|
||||||
from compressor.tests.test_base import test_dir
|
from compressor.tests.test_base import test_dir
|
||||||
|
|
||||||
|
|
||||||
@@ -372,3 +373,7 @@ class SpecializedFiltersTest(TestCase):
|
|||||||
filter = YUIJSFilter('', verbose=1)
|
filter = YUIJSFilter('', verbose=1)
|
||||||
self.assertEqual(filter.command, '{binary} {args} --type=js --verbose')
|
self.assertEqual(filter.command, '{binary} {args} --type=js --verbose')
|
||||||
self.assertEqual(filter.options, (('binary', six.text_type('java -jar yuicompressor.jar')), ('args', six.text_type('')), ('verbose', 1)))
|
self.assertEqual(filter.options, (('binary', six.text_type('java -jar yuicompressor.jar')), ('args', six.text_type('')), ('verbose', 1)))
|
||||||
|
|
||||||
|
def test_clean_css_filter(self):
|
||||||
|
filter = CleanCSSFilter('')
|
||||||
|
self.assertEqual(filter.options, (('binary', six.text_type('cleancss')), ('args', six.text_type(''))))
|
||||||
|
|||||||
@@ -137,9 +137,24 @@ Backend settings
|
|||||||
A filter that uses Zachary Voase's Python port of the YUI CSS compression
|
A filter that uses Zachary Voase's Python port of the YUI CSS compression
|
||||||
algorithm cssmin_.
|
algorithm cssmin_.
|
||||||
|
|
||||||
|
- ``compressor.filters.cleancss.CleanCSSFilter``
|
||||||
|
|
||||||
|
A filter that passes the CSS content to the `clean-css`_ tool.
|
||||||
|
|
||||||
|
.. attribute:: CLEAN_CSS_BINARY
|
||||||
|
|
||||||
|
The clean-css binary filesystem path.
|
||||||
|
|
||||||
|
.. attribute:: CLEAN_CSS_ARGUMENTS
|
||||||
|
|
||||||
|
The arguments passed to clean-css.
|
||||||
|
|
||||||
|
|
||||||
.. _CSSTidy: http://csstidy.sourceforge.net/
|
.. _CSSTidy: http://csstidy.sourceforge.net/
|
||||||
.. _`data: URIs`: http://en.wikipedia.org/wiki/Data_URI_scheme
|
.. _`data: URIs`: http://en.wikipedia.org/wiki/Data_URI_scheme
|
||||||
.. _cssmin: http://pypi.python.org/pypi/cssmin/
|
.. _cssmin: http://pypi.python.org/pypi/cssmin/
|
||||||
|
.. _`clean-css`: https://github.com/GoalSmashers/clean-css/
|
||||||
|
|
||||||
|
|
||||||
- ``compressor.filters.template.TemplateFilter``
|
- ``compressor.filters.template.TemplateFilter``
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user