Removed CompassFilter again due to the orthogonal behavior of its CLI. Use django-compass instead.
This commit is contained in:
		| @@ -40,11 +40,6 @@ class CompressorSettings(AppSettings): | ||||
|     YUI_JS_ARGUMENTS = '' | ||||
|     DATA_URI_MAX_SIZE = 1024 | ||||
|  | ||||
|     COMPASS_BINARY = 'compass' | ||||
|     COMPASS_ARGUMENTS = ' --no-line-comments --output-style expanded' | ||||
|     COMPASS_PLUGINS = [] | ||||
|     COMPASS_IMAGES_DIR = 'images/' | ||||
|  | ||||
|     # the cache backend to use | ||||
|     CACHE_BACKEND = None | ||||
|     # the dotted path to the function that creates the cache key | ||||
| @@ -116,7 +111,4 @@ class CompressorSettings(AppSettings): | ||||
|                 "must be a list or tuple. Check for missing commas.") | ||||
|         return value | ||||
|  | ||||
|     def configure_compass_images_dir(self, value): | ||||
|         return self.configure_url(value) | ||||
|  | ||||
| settings = CompressorSettings(prefix="COMPRESS") | ||||
|   | ||||
| @@ -1,40 +0,0 @@ | ||||
| import tempfile | ||||
| from os import path | ||||
|  | ||||
| from compressor.conf import settings | ||||
| from compressor.filters import CompilerFilter | ||||
|  | ||||
|  | ||||
| class CompassFilter(CompilerFilter): | ||||
|     """ | ||||
|     Converts Compass files to css. | ||||
|     """ | ||||
|     command = "{binary} compile --force --quiet --boring {args} " | ||||
|     options = ( | ||||
|         ("binary", settings.COMPRESS_COMPASS_BINARY), | ||||
|         ("args", settings.COMPRESS_COMPASS_ARGUMENTS), | ||||
|     ) | ||||
|  | ||||
|     def input(self, *args, **kwargs): | ||||
|         if self.filename is None: | ||||
|             self.filename = kwargs.pop('filename') | ||||
|         if not (self.filename.lower().endswith('scss') or | ||||
|                 self.filename.lower().endswith('sass')): | ||||
|             return '' | ||||
|         tmpdir = tempfile.mkdtemp() | ||||
|         parentdir = path.abspath(path.dirname(self.filename)) | ||||
|         self.cwd = path.dirname(parentdir) | ||||
|         self.infile = open(self.filename) | ||||
|         outfile_name = path.splitext(path.split(self.filename)[1])[0] + '.css' | ||||
|         self.options += ( | ||||
|             ('infile', self.filename), | ||||
|             ('tmpdir', tmpdir), | ||||
|             ('sassdir', parentdir), | ||||
|             ('outfile', path.join(tmpdir, outfile_name)), | ||||
|             ('imagesdir', settings.COMPRESS_COMPASS_IMAGES_DIR), | ||||
|         ) | ||||
|         for plugin in settings.COMPRESS_COMPASS_PLUGINS: | ||||
|             self.command += ' --require %s' % plugin | ||||
|         self.command += (' --sass-dir {sassdir} --css-dir {tmpdir}' | ||||
|                          ' --images-dir {imagesdir} {infile}') | ||||
|         return super(CompassFilter, self).input(*args, **kwargs) | ||||
| @@ -102,26 +102,9 @@ A filter that passes the CSS content to the `YUI compressor`_. | ||||
| A filter that uses Zachary Voase's Python port of the YUI CSS compression | ||||
| algorithm cssmin_. | ||||
|  | ||||
| ``compressor.filters.compass.CompassFilter`` | ||||
| """""""""""""""""""""""""""""""""""""""""""" | ||||
|  | ||||
| A filter that runs Compass_'s compile command. **(BETA)** | ||||
|  | ||||
| - ``COMPRESS_COMPASS_BINARY`` -- The compass CLI tool filesystem path. | ||||
|  | ||||
| - ``COMPRESS_COMPASS_ARGUMENTS`` -- The arguments passed to the compass CLI tool. | ||||
|  | ||||
| - ``COMPRESS_COMPASS_PLUGINS`` -- A list of plugins names that are passed to | ||||
|   compass' require option e.g. ``['my_plugin']`` leads to passing | ||||
|   ``--require my_plugin``. | ||||
|  | ||||
| - ``COMPRESS_COMPASS_IMAGES_DIR`` -- The directory where you keep your images, | ||||
|   pass as ``--images-dir`` to the compass compiler. Defaults to ``'images/'``. | ||||
|  | ||||
| .. _CSSTidy: http://csstidy.sourceforge.net/ | ||||
| .. _`data: URIs`: http://en.wikipedia.org/wiki/Data_URI_scheme | ||||
| .. _cssmin: http://pypi.python.org/pypi/cssmin/ | ||||
| .. _Compass: http://compass-style.org/ | ||||
|  | ||||
|  | ||||
| COMPRESS_JS_FILTERS | ||||
|   | ||||
| @@ -33,43 +33,6 @@ CssTidyTestCase = skipIf( | ||||
| )(CssTidyTestCase) | ||||
|  | ||||
|  | ||||
| class CompassTestCase(TestCase): | ||||
|  | ||||
|     def setUp(self): | ||||
|         self.old_debug = settings.DEBUG | ||||
|         self.old_compress_css_filters = settings.COMPRESS_CSS_FILTERS | ||||
|         self.old_compress_url = settings.COMPRESS_URL | ||||
|         self.old_enabled = settings.COMPRESS_ENABLED | ||||
|         settings.DEBUG = True | ||||
|         settings.COMPRESS_ENABLED = True | ||||
|         settings.COMPRESS_CSS_FILTERS = [ | ||||
|             'compressor.filters.compass.CompassFilter', | ||||
|             'compressor.filters.css_default.CssAbsoluteFilter', | ||||
|         ] | ||||
|         settings.COMPRESS_URL = '/media/' | ||||
|  | ||||
|     def tearDown(self): | ||||
|         settings.DEBUG = self.old_debug | ||||
|         settings.COMPRESS_URL = self.old_compress_url | ||||
|         settings.COMPRESS_ENABLED = self.old_enabled | ||||
|         settings.COMPRESS_CSS_FILTERS = self.old_compress_css_filters | ||||
|  | ||||
|     def test_compass(self): | ||||
|         template = u"""{% load compress %}{% compress css %} | ||||
|         <link rel="stylesheet" href="{{ MEDIA_URL }}sass/screen.scss" type="text/css"> | ||||
|         <link rel="stylesheet" href="{{ MEDIA_URL }}sass/print.scss" type="text/css"> | ||||
|         {% endcompress %} | ||||
|         """ | ||||
|         context = {'MEDIA_URL': settings.COMPRESS_URL} | ||||
|         out = css_tag("/media/CACHE/css/8ff1cfd8787d.css") | ||||
|         self.assertEqual(out, render(template, context)) | ||||
|  | ||||
| CompassTestCase = skipIf( | ||||
|     find_command(settings.COMPRESS_COMPASS_BINARY) is None, | ||||
|     'Compass binary %r not found' % settings.COMPRESS_COMPASS_BINARY | ||||
| )(CompassTestCase) | ||||
|  | ||||
|  | ||||
| class PrecompilerTestCase(TestCase): | ||||
|  | ||||
|     def setUp(self): | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Jannis Leidel
					Jannis Leidel