Skip to content

Commit 88009b8

Browse files
committed
2 parents c753afa + d4d6c57 commit 88009b8

File tree

5 files changed

+8
-7
lines changed

5 files changed

+8
-7
lines changed

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ be written to.
129129
``COMPRESS_CSS_FILTERS``
130130
------------------------
131131

132-
:Default: ``[]``
132+
:Default: ``['compressor.filters.css_default.CssAbsoluteFilter]``
133133

134134
A list of filters that will be applied to CSS.
135135

compressor/conf/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
STORAGE = getattr(settings, 'COMPRESS_STORAGE', 'compressor.storage.CompressorFileStorage')
99

1010
COMPRESS = getattr(settings, 'COMPRESS', not settings.DEBUG)
11-
COMPRESS_CSS_FILTERS = getattr(settings, 'COMPRESS_CSS_FILTERS', [])
11+
COMPRESS_CSS_FILTERS = getattr(settings, 'COMPRESS_CSS_FILTERS', ['compressor.filters.css_default.CssAbsoluteFilter'])
1212
COMPRESS_JS_FILTERS = getattr(settings, 'COMPRESS_JS_FILTERS', ['compressor.filters.jsmin.JSMinFilter'])
1313

1414
COMPRESS_LESSC_BINARY = getattr(settings, 'COMPRESS_LESSC_BINARY', 'lessc')

compressor/css.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ def __init__(self, content, output_prefix="css"):
99
self.extension = ".css"
1010
self.template_name = "compressor/css.html"
1111
self.template_name_inline = "compressor/css_inline.html"
12-
self.filters = ['compressor.filters.css_default.CssAbsoluteFilter']
13-
self.filters.extend(settings.COMPRESS_CSS_FILTERS)
12+
self.filters = list(settings.COMPRESS_CSS_FILTERS)
1413
self.type = 'css'
1514
super(CssCompressor, self).__init__(content, output_prefix)
1615

compressor/filters/css_default.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
from compressor.conf import settings
77
from compressor.utils import get_hexdigest, get_mtime
88

9+
URL_PATTERN = re.compile(r'url\(([^\)]+)\)')
10+
11+
912
class CssAbsoluteFilter(FilterBase):
1013
def input(self, filename=None, **kwargs):
1114
media_root = os.path.abspath(settings.MEDIA_ROOT)
@@ -28,8 +31,7 @@ def input(self, filename=None, **kwargs):
2831
self.media_url = '/'.join(parts[2:])
2932
self.protocol = '%s/' % '/'.join(parts[:2])
3033
self.directory_name = '/'.join([self.media_url, os.path.dirname(self.media_path)])
31-
url_pattern = re.compile(r'url\(([^\)]+)\)')
32-
output = url_pattern.sub(self.url_converter, self.content)
34+
output = URL_PATTERN.sub(self.url_converter, self.content)
3335
return output
3436

3537
def add_mtime(self, url):

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def read(fname):
88

99
setup(
1010
name = "django_compressor",
11-
version = "0.6a1",
11+
version = "0.6a2",
1212
url = 'http://github.com/mintchaos/django_compressor',
1313
license = 'BSD',
1414
description = "Compresses linked and inline javascript or CSS into a single cached file.",

0 commit comments

Comments
 (0)