Commit b360bfcd by Timothée Peignier

ensure templates get compiled properly

parent e55cfa0d
...@@ -54,6 +54,7 @@ class Compressor(object): ...@@ -54,6 +54,7 @@ class Compressor(object):
js = self.concatenate(paths) js = self.concatenate(paths)
if templates: if templates:
js = js + self.compile_templates(templates) js = js + self.compile_templates(templates)
js = "(function() { %s }).call(this);" % js
js = getattr(self.js_compressor(verbose=self.verbose), 'compress_js')(js) js = getattr(self.js_compressor(verbose=self.verbose), 'compress_js')(js)
return js return js
...@@ -88,10 +89,8 @@ class Compressor(object): ...@@ -88,10 +89,8 @@ class Compressor(object):
contents contents
) )
return "\n".join([ return "\n".join([
"(function(){",
"%(namespace)s = %(namespace)s || {};" % {'namespace': namespace}, "%(namespace)s = %(namespace)s || {};" % {'namespace': namespace},
compiled, compiled
"})();"
]) ])
def template_name(self, path, base): def template_name(self, path, base):
...@@ -120,8 +119,7 @@ class Compressor(object): ...@@ -120,8 +119,7 @@ class Compressor(object):
def concatenate(self, paths): def concatenate(self, paths):
"""Concatenate together a list of files""" """Concatenate together a list of files"""
content = '\n'.join([self.read_file(path) for path in paths]) return '\n'.join([self.read_file(path) for path in paths])
return "(function() { %s }).call(this);" % content
def construct_asset_path(self, asset_path, css_path, variant=None): def construct_asset_path(self, asset_path, css_path, variant=None):
"""Return a rewritten asset URL for a stylesheet""" """Return a rewritten asset URL for a stylesheet"""
......
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