-
Notifications
You must be signed in to change notification settings - Fork 188
Register dependencies with Sprockets to enable cache invalidation #12
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
Conversation
Great. Can you find a way to add some tests to this? |
What's the point of adding the note if we're fixing the underlying problem with this change? |
I mean, in development, you don't have any need for purging. That's solely for production. So if this approach doesn't work for production, I don't think it works? |
Will add tests. There's still a problem, though. This will add all the files that we use to extract class names into the cache key, but it won't work for new files being created that reference class names. The processor will never get called at all, unless the existing files already in the cache key are modified by some coincidence. The only way I can think of is to take in a new option, like a list of directories- which will usually just be |
I think adding an entire directory as a dependency makes sense? As long as it picks up app/views/new_directory. Otherwise, yes, agree, we might just document that you do need to do assets:clobber. |
Will add the directory option, make it an array, default it to Will update the docs to remind users to do a Should we also point out that this is a giant problem in Heroku? There isn't actually a way to fix my Heroku deployment now short of installing a special plugin and nuking the entire application build cache. I wound up building assets locally and checking them into VCS. |
We need app/helpers as well. And next step think about how we deal with engines. We preferably need to include all Action Pack view load paths in this. Heroku won't let you run assets:clobber? |
The more I think about this the more it seems like the better way to do it would be to ask people to either run Heroku lets you run any command on a new instance started up for you, but the build machine that |
So what's the answer for making this work better on Heroku? Seems like we need a proper solution here. |
Anyone who deployed to Heroku must clear the build cache using the instructions in https://help.heroku.com/18PI5RSY/how-do-i-clear-the-build-cache before every deployment, unless they decide to compile locally and check in When compile the assets locally everyone needs to run I'm trying to figure out how to disable caching on the asset pipeline, will post once I have a working method. The null_store option doesn't seem to be working for me. |
Closing this PR, I don't think #7 can be solved this way. #7 (comment) details my current workaround and recommendations. |
Fixes #7
The asset pipeline currently doesn't recompile the output CSS at all, because the source Tailwinds CSS file remains the same even if the templates that use the classnames change. This means that calling
assets:precompile
in production does nothing after the first time, even if templates have changed and new purging needs to happen.This PR adds all
files_with_class_names
used as dependencies to the compiled asset, which re-complies the output CSS correctly.