I try to use coffeescript in my Grails-project. To achive this I decided to use coffeescript-resources plugin. But compiled coffee in result view looks like follows:
(function() {
var someFunc;
someFunc = function() {
return alert("hello");
};
}).call(this);
and in this case I cant call it. I have not found any proper configurations in the plugin documentation to avoid using anonymous functions while compiling coffee-file. How can I solve this?
From the fine manual:
So that self-invoking function wrapper exists to prevent you from polluting the global namespace. If you want to put something into the global namespace then you have to put it there explicitly; in a browser, you can do that using:
or
The
@someFuncform assumes that you're at the top of the scope (i.e. not inside another function or class).Alternatively, you could find a way to compile your CoffeeScript with
--bare: