-
Notifications
You must be signed in to change notification settings - Fork 45
Mention using ERBTracker with HAML in README #46
base: master
Are you sure you want to change the base?
Conversation
I made some assumptions about why this isn't automatically registered (i.e. that it's not officially supported). If I'm wrong about that, please correct me. |
# config/initializers/cache_digests.rb | ||
|
||
# Enable experimental HAML support with the ERB Dependency Tracker | ||
CacheDigests::DependencyTracker.register_tracker :haml, CacheDigests::DependencyTracker::ERBTracker |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a similar line for Slim
# Or enable experimental Slim support with the ERB Dependency Tracker
CacheDigests::DependencyTracker.register_tracker :slim, CacheDigests::DependencyTracker::ERBTracker
Hey @tim-vandecasteele, I didn't add Slim because I haven't tested it myself. Can you confirm that it works? |
Yes, I confirm it's working for me. Dependencies are properly calculated when checking with the rake task. |
+1 for this PR. We lost a few hours that would have been saved by this being called out in the README. |
In case anyone is looking for the code for Haml (and other templating languages) support for view template cache digesting in Rails 4, it's referenced in this haml-rails PR: haml/haml-rails#50 Not trying to troll this post, but I think many may end up here if they're looking for how to get haml digestion to work in Rails as the code was ported from this repo. |
+1 for this. Spent some time trying to configure cache_digests and didn't figure out what was up until I check the source. |
FYI, @austenito if you're using the latest |
@eprothro thanks I'll give that a shot! |
@austenito no problem! Please let us know over on haml-rails if you have issues. |
update: https://github.com/indirect/haml-rails/ will now automagically include the initializer code. so if you are using rails you can just put haml-rails in your gemfile and this is taken care of. |
My templates are all in HAML and it took me a while to figure out why my dependencies weren't being recognized and how to fix it.
I added an initializer, as suggested by @tim-vandecasteele in #45
Hopeful this will make it more clear to others.