Created
April 25, 2012 22:23
-
-
Save heynemann/2493973 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def render(self, context): | |
content = self.nodelist.render(context) | |
if not settings.COMPRESS or not len(content.strip()): | |
return content | |
if self.kind == 'css': | |
compressor = CssCompressor(content) | |
if self.kind == 'js': | |
compressor = JsCompressor(content) | |
cachekey = "%s-%s" % (compressor.cachekey, self.mode) | |
output = self.cache_get(cachekey) | |
if output is None: | |
try: | |
if self.mode == OUTPUT_FILE: | |
output = compressor.output() | |
else: | |
output = compressor.output_inline() | |
self.cache_set(cachekey, output) | |
except: | |
from traceback import format_exc | |
raise Exception(format_exc()) | |
return output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment