Skip to content

Commit

Permalink
Merge pull request #448 from Alexx-G/fix/js_wrapping_output
Browse files Browse the repository at this point in the history
Fix for wrapping javascript code.
  • Loading branch information
cyberdelia committed Aug 1, 2015
2 parents 260b127 + 6d915d1 commit 51042e9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,4 @@ or just made Pipeline more awesome.
* Wictor Olseryd <wictor@olseryd.se>
* Zachary Kazanski <kazanski.zachary@gmail.com>
* Zenobius Jiricek <zenobius.jiricek@gmail.com>
* Alex Gavrișco <alexandr@gavrisco.com>
4 changes: 3 additions & 1 deletion docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,9 @@ Wrapped javascript output

All javascript output is wrapped in an anonymous function : ::

(function(){ ... })();
(function(){
//JS output...
})();

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

Expand Down
2 changes: 1 addition & 1 deletion pipeline/compressors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def compress_js(self, paths, templates=None, **kwargs):
js = js + self.compile_templates(templates)

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

compressor = self.js_compressor
if compressor:
Expand Down

0 comments on commit 51042e9

Please sign in to comment.