Skip to content

Commit

Permalink
Merge pull request #569 from Blender3D/configurable-wrapper
Browse files Browse the repository at this point in the history
Make the JS wrapper configurable
  • Loading branch information
davidt committed Jun 7, 2016
2 parents aeca70f + b5198cd commit fa27e1d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

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})();"
2 changes: 1 addition & 1 deletion pipeline/compressors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def compress_js(self, paths, templates=None, **kwargs):
js = js + self.compile_templates(templates)

if not settings.DISABLE_WRAPPER:
js = "(function() {\n%s\n}).call(this);" % js
js = settings.JS_WRAPPER % js

compressor = self.js_compressor
if compressor:
Expand Down
1 change: 1 addition & 0 deletions pipeline/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
'TEMPLATE_SEPARATOR': "_",

'DISABLE_WRAPPER': False,
'JS_WRAPPER': "(function() {\n%s\n}).call(this);",

'CSSTIDY_BINARY': '/usr/bin/env csstidy',
'CSSTIDY_ARGUMENTS': '--template=highest',
Expand Down

0 comments on commit fa27e1d

Please sign in to comment.