-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem with template path since v0.17 #104
Comments
@ggarnier yeah, this is one of the changes I had to implement to keep consistency across the board; Otherwise through different versions of rails and sprocket engines the results were different. The workaround would be to change as necessary (unless I am missing something). |
@AlexRiedler is it possible to set scope on TemplatePath constructor as before (https://github.com/leshill/handlebars_assets/blob/v0.16/lib/handlebars_assets/tilt_handlebars.rb#L91)? I think this could solve the problem. |
i have two template files
before version 0.17 both template has the same namespace, but after |
@ggarnier I am trying to avoid excess work in the slim + haml in production... so using the previous method is not a clear solution; working on a better solution now. |
@attenzione that is super weird, it should be nodes/edit and nodes/show ... what version of rails? (I tested on 4.0) |
@AlexRiedler i use latest 4.1.4, but all time expect |
@attenzione ah, okay that makes more sense. I was actually fixing a bug that had to deal with paths; the new version is very... loosely defined. If you put this in an initializer this should fix your issue: ::HandlebarsAssets.configure do |config|
config.path_prefix = 'assets'
end anything after assets in the path will be then grabbed as the template name. |
@ggarnier actually does ^ also work as a solution also work for you as well ? or not really cause of how the gem is bundled ? (noting that you can write regex's as the path prefix) |
@AlexRiedler very nice, it's resolved my problem! thanx |
@attenzione I think that is mentioned in another ticket; I closed it because it actually is a by-product of the asset compilation pipeline (it does not allow two templates to have the same logical path). |
no, they're not the same logical path, see
and their namespaces should be
but |
yeah... I am still thinking of that case @attenzione; I might 'revert' this change; and remove this idea of 'TemplatePath' and use logical paths instead just for the template names (which means I believe the change I told you above will still work). |
@AlexRiedler in my case, I use the default |
I have a Rails project using handlebars_assets and a personal gem that defines some Handlebars templates. One of the templates in the gem is app/assets/javascripts/my-gem/component/templates/template_name.hbs. Until handlebars_assets 0.16, this template key in the template_namespace was my-gem/component/templates/template_name. But since 0.17, the key is just template_name.
I took a look at handlebars_assets code, and it seems that TemplatePath class constructor got a scope parameter, and now it gets a full_path parameter. This explains the behavior change, as I use the default path_prefix value (which is templates).
The text was updated successfully, but these errors were encountered: