Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

finding the line number of a coffescript error in rails

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?

like image 947
Jules Testard Avatar asked Oct 22 '22 08:10

Jules Testard


1 Answers

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.

like image 164
abject_error Avatar answered Oct 27 '22 10:10

abject_error