Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging CoffeeScript line-by-line

Is there a way to debug CoffeeScript line-by-line?

I understand that it compiles into Javascript. But this sounds like it could make it a pain to debug.

like image 415
Chris Dutrow Avatar asked Jun 17 '12 00:06

Chris Dutrow


People also ask

How do I use CoffeeScript in HTML?

If you are looking to implement coffee script in html, take a look at this. You simple need to add a <script type="text/coffeescript" src="app. coffee"></script> to execute coffee script code in an HTML file.


2 Answers

Update: there's currently a redesign of coffeescript compiler that generates source maps, which should enable you to debug your coffeescript in most recent versions of Google Chrome (18 and upwards I think).

I think it's not production-ready yet, but it's worth mentioning.

like image 137
Miguel Ping Avatar answered Oct 10 '22 20:10

Miguel Ping


if you are running coffeescript from the terminal you can debug it line-for-line using node-inspector, launching your script this way:

coffee --nodejs --debug-brk yourscript.coffee 
like image 26
Lloyd Avatar answered Oct 10 '22 18:10

Lloyd