edvinasbartkus / grails-coffeescript-resources

Another CoffeeScript compiler for Grails
Other
20 stars 10 forks source link

Use CoffeeScriptRedux for source mapped compilation #20

Open divideby0 opened 11 years ago

divideby0 commented 11 years ago

There is a new coffeescript compiler, CoffeeScriptRedux, released today which supports source maps. These effectively eliminate the debugging challenges associated coffeescript by providing linkage between the compiled JavaScript and the original coffeescript file. Chrome Canary builds already support this feature, which means you can debug directly in your browser.

I've started playing around with this using CoffeeScriptRedux on the command line and its a beautiful, beautiful thing. But I'd love it even more if I could use it directly with Grails.

Unfortunately, there's no single js file for compilation in the github project. The project itself uses node.js, so I'm unclear on what exactly would need to be done to compile from Rhino. Once that part is figured out, it should simply be a matter of generating two resources: the normal compiled javascript file and the source map. We'd then need to augment the compiled Javascript file with a comment pointing to the location of the source mapped resource.

divideby0 commented 11 years ago

I've created a Github issue on the CoffeeScriptReduce project soliciting advice on how to compile from Rhino:

https://github.com/michaelficarra/CoffeeScriptRedux/issues/42

divideby0 commented 11 years ago

Please note that Coffeescript 1.6.0 now supports source maps natively:

http://coffeescript.org/#source-maps

So this would probably be safer than using redux.