I just set up CoffeeScript (I'm also using Jade) for Meteor and it seems that my helpers (rendered and events functions too) do not work anymore.
Template.signIn.helpers
showForgotPassword: () ->
return Session.get('showForgotPassword')
The code seems to be properly generated but is embraced in an anonymous function.
I'm getting the following error in the web console:
Uncaught TypeError: Cannot call method 'helpers' of undefined (account.coffee:12)
I'm wondering whether the code is run before the page is fully loaded or if it is due to something else. I've also tried this but nothing changed (though it seems to work in this tutorial):
root = global ? window
root.Template.signIn.helpers
showForgotPassword: () ->
return Session.get('showForgotPassword')
The problem is fixed when I wrap my code with Meteor.startup (see David Weldon post).
if I put .jade and .coffee into same level folder meteor will load .coffee before .jade, then it causes no such template. To prevent this, you can prefix jade files with _.
I think this is solved in meteor-jade v0.2.2
Thanks for the great pointer @Julien.
I run into this issue about a few hours back and have been breaking my head since.
What I did instead of the _ approach, was to name my jade files as .html.jade and my coffeescript files as .js.coffee
That way the jade files are loaded before the coffee files and everything works.
The advantage to the _ approach is that related jade and coffee files are together.
Hope this helps.