Commit 4eecb627 by ara818

central yui compress settings to go through main compress settings so there are…

central yui compress settings to go through main compress settings so there are no hidden settings floating around
parent 6f400b9f
...@@ -13,6 +13,10 @@ COMPRESS_JS_FILTERS = getattr(settings, 'COMPRESS_JS_FILTERS', ['compress.filter ...@@ -13,6 +13,10 @@ COMPRESS_JS_FILTERS = getattr(settings, 'COMPRESS_JS_FILTERS', ['compress.filter
COMPRESS_CSS = getattr(settings, 'COMPRESS_CSS', {}) COMPRESS_CSS = getattr(settings, 'COMPRESS_CSS', {})
COMPRESS_JS = getattr(settings, 'COMPRESS_JS', {}) COMPRESS_JS = getattr(settings, 'COMPRESS_JS', {})
COMPRESS_YUI_BINARY = getattr(settings, 'COMPRESS_YUI_BINARY', 'java -jar yuicompressor.jar')
COMPRESS_YUI_CSS_ARGUMENTS = getattr(settings, 'COMPRESS_YUI_CSS_ARGUMENTS', '')
COMPRESS_YUI_JS_ARGUMENTS = getattr(settings, 'COMPRESS_YUI_JS_ARGUMENTS', '')
if COMPRESS_CSS_FILTERS is None: if COMPRESS_CSS_FILTERS is None:
COMPRESS_CSS_FILTERS = [] COMPRESS_CSS_FILTERS = []
......
import subprocess import subprocess
from django.conf import settings from compress.conf import settings
from compress.filter_base import FilterBase, FilterError from compress.filter_base import FilterBase, FilterError
BINARY = getattr(settings, 'COMPRESS_YUI_BINARY', 'java -jar yuicompressor.jar')
CSS_ARGUMENTS = getattr(settings, 'COMPRESS_YUI_CSS_ARGUMENTS', '')
JS_ARGUMENTS = getattr(settings, 'COMPRESS_YUI_JS_ARGUMENTS', '')
class YUICompressorFilter(FilterBase): class YUICompressorFilter(FilterBase):
def filter_common(self, content, type_, arguments): def filter_common(self, content, type_, arguments):
command = '%s --type=%s %s' % (BINARY, type_, arguments) command = '%s --type=%s %s' % (settings.COMPRESS_YUI_BINARY, type_, arguments)
if self.verbose: if self.verbose:
command += ' --verbose' command += ' --verbose'
p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE) p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, \
stdin=subprocess.PIPE, stderr=subprocess.PIPE)
p.stdin.write(content) p.stdin.write(content)
p.stdin.close() p.stdin.close()
...@@ -38,7 +34,7 @@ class YUICompressorFilter(FilterBase): ...@@ -38,7 +34,7 @@ class YUICompressorFilter(FilterBase):
return filtered_css return filtered_css
def filter_js(self, js): def filter_js(self, js):
return self.filter_common(js, 'js', JS_ARGUMENTS) return self.filter_common(js, 'js', settings.COMPRESS_YUI_CSS_ARGUMENTS)
def filter_css(self, css): def filter_css(self, css):
return self.filter_common(css, 'css', CSS_ARGUMENTS) return self.filter_common(css, 'css', settings.COMPRESS_YUI_JS_ARGUMENTS)
\ No newline at end of file \ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment