Closed jithugopal closed 10 years ago
Have you required the templates directory as a directive in your application.js ?
As explained here: https://github.com/leshill/handlebars_assets#templates-directory
Yup, I required it before //= require_tree .
I have been trying to reproduce, but with no luck; can you try to provide a minimal set of code that reproduces.
I tried this on a vanilla rails app and it worked. It looks like my assumptions were a bit off.
The namespace global object wasn't generated because I didn't have any template files in my template directory. My assumption was that the namespace would be generated regardless of whether the templates exists or not (I think this is how smt_rails work as well).
Is there a particular reason you generate the namespace object only when there are template files? In the absence of templates, ideally the 'HandlebarsTemplates' namespace object should return me nothing, rather than complaining no refernce to HandlebarsTemplates found.
the logic behind this has to do with the fact you need to include some file (otherwise cannot inject JS), I could add an entire other file into the Repo for exactly this purpose, but it does not seem like the best idea, or provide any benefit to the overall project (without breaking backwards compatibility).
Makes sense. Do you think this is intuitive enough? Probably drop a line in the README?
Noted, thanks @jithugopal
I just added the gem to my rails app, required
handlebars
in application.js, bundled and rebooted my server.I am unable to get the HandlebarsTemplates namespace in javascript console. I am not entirely sure what I am missing here.
Rails 3.2.16