def save(self, storage, name, meta): """Saves this asset to the given storage.""" if self._compile: contents = self.get_contents() if self._rescope: contents = "(function(window){%s}(window));" % contents compiled_contents = default_javascript_compiler.compile(contents, force_compile=True) # Write the output. storage.save(name, ContentFile(compiled_contents)) else: # Just save the joined code. super(JavascriptAsset, self).save(storage, name, meta)
def save(self, storage, name, meta): """Saves this asset to the given storage.""" if self._compile: contents = self.get_contents() if self._rescope: contents = "(function(window){%s}(window));" % contents compiled_contents = default_javascript_compiler.compile( contents, force_compile=True) # Write the output. storage.save(name, ContentFile(compiled_contents)) else: # Just save the joined code. super(JavascriptAsset, self).save(storage, name, meta)
def testJavascriptCompiler(self): self.assertEqual(default_javascript_compiler.compile("function(){var foo = 'foo';}"), 'function(){var a="foo"};')