leshill / handlebars_assets

Use handlebars.js templates with the Rails asset pipeline.
MIT License
649 stars 159 forks source link

Update engine registration target to app.assets #116

Closed vijoc closed 9 years ago

vijoc commented 9 years ago

I had some issues with a setup including requirejs-rails and hamlbars. I first implemented this change locally in my app, but figured others might benefit from it. I'm not sure why this fixed the issue, but it did.

vijoc commented 9 years ago

Actually I'm still having issues with integrating handlebars_assets to my application. The issue is that the AMD modules are rendered in a very wonky way; the return value is a string containing the define([handlebars], .... header and everything. Still investigating.

EDIT: Nevermind, the issue was with cached assets.

AlexRiedler commented 9 years ago

@vijoc I remember for hamlbars prior to v2 there were issues because of registering the same extension (e.g. hamlbars and handlbars_assets gem both would try to grab .hamlbars).

I would recommend configuring the handlebars_assets get (this gem); so that:

HandlebarsAssets.Config.configure do |config|
    config.hamlbars_extensions = '.hamlbars_assets'
end

that way it will not conflict with hamlbars gem; tell me how it goes and I might add it to the readme.

vijoc commented 9 years ago

Actually I resolved the issue by setting config.hamlbar_extensions = [], which of course has the same effect in this case. As I poked around the codebase I found the option haml_enabled but it doesn't seem to be used, at least not when deciding whether to use the haml engine or not. Maybe that could be used to tell handlebars_assets not to worry about .hamlbars files by default?

AlexRiedler commented 9 years ago

@vijoc yup that is the other way to do it :) but basically the same effect.