-
Notifications
You must be signed in to change notification settings - Fork 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
astro-purgecss is modifying files keeping the hash #450
Comments
Actually, I'm not sure if it's the right call to change these filenames. because I assume the same file will produce the same results when passed to purgecss unless the purgecss settings have been changed between builds? Lets say a file has a hash "ABC" When it is passed to purgecss it will keep the same hash which is wrong because the hash doesn't represent the trimmed file but when cached and the same file was passed to purgecss again it won't change. so the cached content is still valid. I believe this issue is only valid if the purgecss settings have been changed between 2 builds, correct me if I'm wrong. |
I am afraid the problem already arises when only HTML is changed:
A user that goes to the webpage after step 6, will cache the CSS file with only one rule forever. If he returns after step 9, he will not get the updated CSS file. The CSS file contains the right content, but the browser will not download it again because the name did not change. |
Yes indeed, I completely forget about HTML changes. Thanks @druettiger I'll try to look into this soon. Feel free to open a PR if you already know the solution and want it to be released quickly. |
Describe the bug
The assets built by Astro in the
dist/client/_astro/
folder are all named with a hash and therefore are usually be given long cache headers.astro-purgecss is modifying these files without changing the hash. With long cache headers, browsers will not request updated versions.
To Reproduce
Steps to reproduce the behavior:
astro build
dist/client/_astro/generated.HASH.css
astro build
dist/client/_astro/generated.HASH.css
Expected behavior
astro-purgecss should change the hash after modifying files.
The text was updated successfully, but these errors were encountered: