WebStorm wraps transpiled CoffeeScript classes into self calling function Follow
As in the topic. Is there any option that when I translate .coffee file into .js it will look like the one I would translate onto CoffeeScript official webpage? For example(from cs page):
class animal
constructor: (@name) ->
move: (meters) ->
alert @name + " moved #{meters}m."
in webstorm is translated to:
(function() {
var animal;
animal = (function() {
function animal(name) {
this.name = name;
}
animal.prototype.move = function(meters) {
return alert(this.name + (" moved " + meters + "m."));
};
return animal;
})();
}).call(this);
and I cant get instance of this class outside animal.coffee file. Is there any option that webstorm would automaticly output .js file like this?:
var animal; animal = (function() { function animal(name) { this.name = name; } animal.prototype.move = function(meters) { return alert(this.name + (" moved " + meters + "m.")); }; return animal; })();
Maybe it is some silly question, but I just started using webstorm and I cant find any information about this issue. For any help I would be gratefull.
Please sign in to leave a comment.
It is not WebStorm, it's a CoffeeScript compiler:) If you like to change this default behavior, you have to pass '--bare' option to compiler. Just add it to file watcher arguments, like:
See attached screenshot.
Refer to http://coffeescript.org/, Usage section:
Attachment(s):
bare.png