Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Mention using ERBTracker with HAML in README #46

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

nickurban
Copy link

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.

@nickurban
Copy link
Author

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

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

@nickurban
Copy link
Author

Hey @tim-vandecasteele, I didn't add Slim because I haven't tested it myself.

Can you confirm that it works?

@tim-vandecasteele
Copy link

Yes, I confirm it's working for me. Dependencies are properly calculated when checking with the rake task.

@eprothro
Copy link

eprothro commented Aug 5, 2013

+1 for this PR. We lost a few hours that would have been saved by this being called out in the README.

@eprothro
Copy link

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.

@austenito
Copy link

+1 for this. Spent some time trying to configure cache_digests and didn't figure out what was up until I check the source.

@eprothro
Copy link

FYI, @austenito if you're using the latest haml-rails release, it includes the necessary code to ensure cache digesting works properly.

@austenito
Copy link

@eprothro thanks I'll give that a shot!

@eprothro
Copy link

@austenito no problem! Please let us know over on haml-rails if you have issues.

@jjb
Copy link

jjb commented Jan 19, 2015

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.

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

Successfully merging this pull request may close these issues.

5 participants