Commit b5198cdc by Nikita

Made the JS wrapper configurable

parent aeca70f5
...@@ -298,4 +298,7 @@ All javascript output is wrapped in an anonymous function : :: ...@@ -298,4 +298,7 @@ All javascript output is wrapped in an anonymous function : ::
This safety wrapper, make it difficult to pollute the global namespace by accident and improve performance. This safety wrapper, make it difficult to pollute the global namespace by accident and improve performance.
You can override this behavior by setting ``DISABLE_WRAPPER`` to ``True``. You can override this behavior by setting ``DISABLE_WRAPPER`` to ``True``. If you want to use your own wrapper, change
the ``JS_WRAPPER`` setting. For example: ::
JS_WRAPPER = "(function(){stuff();%s})();"
...@@ -62,7 +62,7 @@ class Compressor(object): ...@@ -62,7 +62,7 @@ class Compressor(object):
js = js + self.compile_templates(templates) js = js + self.compile_templates(templates)
if not settings.DISABLE_WRAPPER: if not settings.DISABLE_WRAPPER:
js = "(function() {\n%s\n}).call(this);" % js js = settings.JS_WRAPPER % js
compressor = self.js_compressor compressor = self.js_compressor
if compressor: if compressor:
......
...@@ -38,6 +38,7 @@ DEFAULTS = { ...@@ -38,6 +38,7 @@ DEFAULTS = {
'TEMPLATE_SEPARATOR': "_", 'TEMPLATE_SEPARATOR': "_",
'DISABLE_WRAPPER': False, 'DISABLE_WRAPPER': False,
'JS_WRAPPER': "(function() {\n%s\n}).call(this);",
'CSSTIDY_BINARY': '/usr/bin/env csstidy', 'CSSTIDY_BINARY': '/usr/bin/env csstidy',
'CSSTIDY_ARGUMENTS': '--template=highest', 'CSSTIDY_ARGUMENTS': '--template=highest',
......
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