Debugging coffeescript in firefox w/ firebug
How do you debug coffeescript in Firefox w/ firebug when using rails 3.0.7?
I am using Barista and Coffeescript. It works just fine (a basic 'alert "hello"' is running).
However, when there are obviously errors... nothing happens. How can I get more indepth feedback? :/
This is how I add it to my erb file:
<%= coffeescript_include_tag "lib/dynamic_menu", "views/tour" %>
This is what my coffeescript installation is including in the page:
<script src="/javascripts/coffeescript.js" type="text/javascript"></script>
<script s开发者_运维技巧rc="/coffeescripts/lib/dynamic_menu.coffee" type="text/coffeescript"></script>
<script src="/coffeescripts/views/tour.coffee" type="text/coffeescript"></script>
When I look in Firebug, I can see it loading these, but it just says "200 OK". Other than that, nothing happens (because obviously my code is wrong... but without feedback, how am I supposed to know? :/
I haven't seen anyone use the coffeescript_include_tag
feature of Barista before, and honestly, I don't see the point of it. It might be nice once browsers offer native debugging support for CoffeeScript (which is certainly coming), but for now, you're better off taking advantage of Barista's ability to compile to JavaScript transparently. Just use the javascript_include_tag
instead, or turn off Barista's embedded_interpreter
option.
The Barista docs aren't totally clear as far as "How to Get Started" right now, so you may want to check out this blog post.
I also suggest using barista_growl (which I wrote) if you're on a Mac, so that you get better reporting of CoffeeScript compilation errors.
(The reason you're seeing 200 OK
, by the way, is that the .coffee
files are loaded via Ajax, after the initial page load. That may confuse some JavaScript debugging tools.)
精彩评论