0

First I will provide some examples:

  1. First
  2. Second

Both examples of some online compilers create the same result from the same input.

If I take the input, put it into my coffee file and compile it using laravel-elixir, I get this:

(function() {
  (function($) {})(jQuery);
}).call(this);

Can someone please tell me why?

It's not that I am unable to work with (Some major testings worked very well), but I want to understand the outcome and what I did wrong.

HINT: I know I am using Elixir on top of Gulp. I didn't check what will happen with i compile my coffee with another Gulp Addon instead of Elixir. The thing is: I will use Elixir and want to know what's different.

If possible, I want to get elixir to produce the expected output like in 1. and 2.

Isfirs
  • 124
  • 1
  • 12
  • Straight from the fine manual: ["Although suppressed within this documentation for clarity, all CoffeeScript output is wrapped in an anonymous function: `(function(){ ... })();` This safety wrapper, combined with the automatic generation of the `var` keyword, make it exceedingly difficult to pollute the global namespace by accident."](http://coffeescript.org/#lexical-scope) – mu is too short Jul 08 '16 at 15:18
  • Possible duplicate of [Coffeescript wrapping files in a function](http://stackoverflow.com/questions/7082373/coffeescript-wrapping-files-in-a-function) – fracz Jul 08 '16 at 19:17
  • @fracz There is a similarity, but it is not the same topic... He wonders why it is wrapped, I wonder how I get 2 results from 3 compilers. I expected the output to be like the links I provided... But local the compilers something else instead. Maybe you got some docs about how I can wrap it up so I can get something like `function() { this('#id'); }.call(jQuery);` Thank you in advance... – Isfirs Jul 12 '16 at 07:19

0 Answers0