Skip to content

Commit fa27e1d

Browse files
committed
Merge pull request jazzband#569 from Blender3D/configurable-wrapper
Make the JS wrapper configurable
2 parents aeca70f + b5198cd commit fa27e1d

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

docs/configuration.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,4 +298,7 @@ All javascript output is wrapped in an anonymous function : ::
298298

299299
This safety wrapper, make it difficult to pollute the global namespace by accident and improve performance.
300300

301-
You can override this behavior by setting ``DISABLE_WRAPPER`` to ``True``.
301+
You can override this behavior by setting ``DISABLE_WRAPPER`` to ``True``. If you want to use your own wrapper, change
302+
the ``JS_WRAPPER`` setting. For example: ::
303+
304+
JS_WRAPPER = "(function(){stuff();%s})();"

pipeline/compressors/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def compress_js(self, paths, templates=None, **kwargs):
6262
js = js + self.compile_templates(templates)
6363

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

6767
compressor = self.js_compressor
6868
if compressor:

pipeline/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
'TEMPLATE_SEPARATOR': "_",
3939

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

4243
'CSSTIDY_BINARY': '/usr/bin/env csstidy',
4344
'CSSTIDY_ARGUMENTS': '--template=highest',

0 commit comments

Comments
 (0)