I am trying to use this bundle with the coffee files generated for each controller. I’m just delving into this for the first time by just doing the traditional
$ ->
alert('Hello World!')
It works fine when I view the page, and doing Command+B also displays the desired JS code. However, I can’t do Command+R. I just get ReferenceError: $ is not defined. I understand that it probably can’t reference the jQuery file that defines $, but can’t for the life of me figure out how to do that. Come to think of it, I’m wondering if it’s a sensible thing to want to do this…
What’s the best practice when using CoffeeScript and TextMate in Rails 3.1 development?
Thanks,
Dany.
Right, because Command+R means “run this
.coffeefile under NodeJS” (basically equivalent tocoffee myfile.coffee). Even if$weren’t an issue ($ = require 'jquery'will fix this, after younpm install jquery),alertcertainly would be.Now, you might be thinking: “OK, crazy idea: What if I split my front-end into Node modules, which are easy to test, and then convert them to browser-friendly code for deployment?” In that case, I have good news for you: sstephenson stole your crazy idea months ago, and it’s called Stitch. Give it a try!