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
Force usage of hamlit in Rails when haml gem is also bundled? #30
Comments
Thank you for reporting an issue. I could reproduce your environment and resolve it. # config/initializers/hamlit.rb
module Hamlit
class TemplateHandler
def call(template)
Engine.new(
generator: Temple::Generators::RailsOutputBuffer,
filename: template.identifier,
).call(template.source)
end
end
end
ActionView::Template.register_template_handler(
:haml,
Hamlit::TemplateHandler.new,
) I think Hamlit should overwrite Haml by default. I'll fix it later. |
Thanks for the quick help! In exploring the problem further, I think I may have been mistaken about
But when looking at what is actually rendering the template, it was Also, the snippet you pasted I had a typo I think. There is not a # config/initializers/hamlit.rb
module Hamlit
class TemplateHandler
def call(template)
Engine.new(
generator: Temple::Generators::RailsOutputBuffer,
attr_quote: '"',
).call(template.source)
end
end
end
ActionView::Template.register_template_handler(
:haml,
Hamlit::TemplateHandler.new,
) Thank you again! Edit: Also wanted to add that I'm seeing 20% faster page loads and 20% less memory usage in switching to Hamlit. Which is awesome! |
Hamlit test cases generate incompatibilities against Haml. You can check which template engine is used with them. https://github.com/k0kubun/hamlit/tree/39b4634a3e1e3de529cda01c380c33b9fa54378f/doc/haml
🙇
Thank you for using hamlit. :) |
I'm running into this same issue, how can I tell for sure that Hamlit is being used and not Haml? |
Didn't #30 (comment) work for you? If it didn't, please try to put |
I'm in the situation where I am trying to use
hamlit
in my Rails application, but unfortunately I have a Gemfile dependency onrails_admin
, which has a dependency on the originalhaml
gem. With bothhaml
andhamlit
bundled, it seems like the originalhaml
gem wins out. Is there a way that I can force Rails to usehamlit
and nothaml
when rendering templates?Thanks for the help.
The text was updated successfully, but these errors were encountered: