Is there any coffee script plugin or some kind of option which would wrap the generated javascript automatically with anonymous function on compile?
I know Web Essentials 2013 for Visual studio has this kind of option.
This coffee...
foo () ->
return 'bar'
...would compile to this:
(function() {
var foo;
foo = function() {
return 'bar';
};
}).call(this);
Instead of this:
var foo;
foo = function() {
return 'bar';
};
It depends on what coffeescript package you are using. In "Better Coffeescript"-package you just have to set "noWrapper": false in your package settings.