jimsynz / hamlbars

Some extensions to HAML to allow generation of Handlebars templates.
https://github.com/jamesotron/hamlbars.git
MIT License
179 stars 43 forks source link

Closures not being used #35

Closed apolzon closed 11 years ago

apolzon commented 12 years ago

Both the closure and precompile modules are not firing as expected. I believe I tracked it down to the evaluate_without_precompile/closure method already being defined. For precompiling, I was able to get it to work properly by changing the evaluate alias to use _with_js_precompiler, however the same hack on the closure module did not help.

Without closures (I'm pretty sure this would not fine with a closure), on page load, the HandlebarsTemplates object does not yet exist, so HandlebarsTemplates[] fails on assignment.

The handlebars_assets gem also ensures the object already exists inside their closure:

 (function() {
            this.HandlebarsTemplates || (this.HandlebarsTemplates = {});
            this.HandlebarsTemplates["..."] = ...
jimsynz commented 12 years ago

You're right. I think I need to redesign the way that this behaviour is being added, perhaps with something more like an after_render filter.

jimsynz commented 11 years ago

Closing because template compilation will be removed with 2.0, you can use handlebars_assets or ember-rails to compile your templates.