Handlebars with Jammit and Rails 2.3
-
03-07-2021 - |
Question
I am trying to get Handlebars to work with Jammit and Rails 2.3... and I am struggling. I read different comments on how to make it work. For instance here:
https://gist.github.com/1118201
the last comment seems to imply that simply adding
template_function: Handlebars.template
in your assets.yml should work, but it does not for me. When I do :
JST[template_id](params)
I get an javascript error:
TypeError: Object function anonymous(Handlebars,depth0,helpers,partials,data) { helpers = helpers || Handlebars.helpers; return "div class='timeline_container'\n/div \n"; } has no method 'match'
Any idea?
Thanks a lot! PJ
No correct solution
OTHER TIPS
Answering my own question... hopefully it will help others.
It does work with the "compile" method included in Handlebars. You just need to add: template_function: Handlebars.compile at the top of your assets.yml file. No need for an extra script (Handlebars 1.0 rc.1).