I am trying to find a good way to debug my coffeescript in Rails. My configuration settings for assets are :
# Do not compress assets
config.assets.compress = false
# Expands the lines which load the assets
config.assets.debug = true
When I have errors in my coffeescript files such as wepic.js.coffee.erb
after doing a rake assets:precompile
task, the only debugging information i get is the error type and the filename :
rake aborted!
SyntaxError: unexpected TERMINATOR
(in /home/jtestard/projects/git/webdamsystem/app/assets/javascripts/wepic.js.coffee.erb)
Sometimes this is not enough to spot the error quickly and I was trying to get a better trace with maybe the line/column number. Does anyone know of a way to get this type of information?
If you have NPM/NodeJS installed (and npm install coffee-script -g
), you can try compiling with coffee -c <filename>
to see the line number. Textmate/Sublime also have plugins where you can see the compiled output of a coffescript file with a key combination, but they require NodeJS/NPM installed as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With