Added COMPRESS_COMPASS_IMAGES_DIR option to allow a more flexible support of sprites. Closes #87.

This commit is contained in:
Maor Ben-Dayan
2011-07-17 19:38:43 +03:00
committed by Jannis Leidel
parent 349f52068e
commit 10ecc0e124
3 changed files with 9 additions and 2 deletions

View File

@@ -43,6 +43,7 @@ class CompressorSettings(AppSettings):
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
@@ -115,4 +116,7 @@ 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")

View File

@@ -31,10 +31,10 @@ class CompassFilter(CompilerFilter):
('tmpdir', tmpdir),
('sassdir', parentdir),
('outfile', path.join(tmpdir, outfile_name)),
('imagedir', settings.COMPRESS_URL),
('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}'
' --image-dir {imagedir} {infile}')
' --images-dir {imagesdir} {infile}')
return super(CompassFilter, self).input(*args, **kwargs)

View File

@@ -115,6 +115,9 @@ A filter that runs Compass_'s compile command. **(BETA)**
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/