How to use in browser a JS file generated from IcedCoffeeScript

361 views Asked by At

When I use vanilla CoffeeScript, I compile a *.coffee files and send resulted *.js to client. To get rid of dependence on the module async.js in client side, I found the IcedCoffeeScript language extension. But when I compiled my code (wich has await and defer keywords) into *.js, in result I found non-client-side code:

iced = require('iced-coffee-script').iced; 

So I can't use it in client side. Could to solving this problem?

2

There are 2 answers

0
Rafael Marini On BEST ANSWER

You need to set the --runtime flag on iced compiler to "inline". http://maxtaco.github.io/coffee-script/

0
Dylan On

I use the following gist successfully in production with version 1.6.3-g

https://gist.github.com/littleloops/7546859