Skip to content
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

Overriding the Handlebars templates is impossible in production #1567

Closed
CallMeSH opened this issue Oct 31, 2016 · 4 comments
Closed

Overriding the Handlebars templates is impossible in production #1567

CallMeSH opened this issue Oct 31, 2016 · 4 comments

Comments

@CallMeSH
Copy link

I recently faced a bug on Solidus 1.3.1 related to the backend handlebars templates.
I needed for one of my clients to override the variants suggestions in the autocomplete forms.
I first implemented my override by writing a new template in:
/vendor/assets/javascript/spree/backend/templates/variants/autocomplete.hbs.erb

It worked fine in development but in production, the original template was still in place.
After some research I thought that this would be related to the assets pipeline compilation process and by reading the minified JS I discovered that both versions lived in the same file.

My version of the template is appended all the way at the end of the compiled JS file. Unfortunately, the code binding the template to the variant search form is way higher in the code and call the original template function.

Any ideas how this could be fixed ?
Thanks!

@evil-c
Copy link

evil-c commented Nov 7, 2016

Hi @CallMeSH,

Curious if you found a workaround/solution to this yet. I've run into the same issue.

Thanks.

@CallMeSH
Copy link
Author

CallMeSH commented Nov 8, 2016

Unfortunately no, still waiting for help from the Solidus team.

@jhawthorn
Copy link
Contributor

I think unfortunately these can't be overridden. Neither can any JS asset. This is a sprockets issue, and is outside our control.

This is made extra confusing because dev and production behave differently (due to sprocket's debug setting). Sometimes attempting to override a JS file will result in both the overridden and not overridden file being included.

@cbrunsdon has looked into this more than me and might be able to clarify.

@tvdeyen
Copy link
Member

tvdeyen commented Nov 24, 2016

@CallMeSH is it possible that you try out #1613 in you're app and see if this fixes your issues?

Should be as easy as:

# Gemfile
gem 'solidus', github: 'jhawthorn/solidus', branch: 'remove_require_tree'

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants