Browser caching on Chrome breaks website
Looks like Chrome is caching the CSS/JS and it is not being updated when the website is updated. I would recommend cache fingerprinting (use main.0fklh924sd834.css instead of main.css).
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
We would need to create a manifest file, use PHP to read that file on every page render, and rewrite the script tags. Ideally we would do this with all assets. In general, this is kinda a pain to do with what we are currently using. I would love to see most of this site go JavaScript with a build step that handles all of this for us.
I am trying to create a PR for this. On the PHP end we could make a function like get_asset, which takes the asset name and adds the MD5 hash to it (in: main.js, out: main.398f9df83.js). On the JS end we could add (or write, it's not that hard) a Gulp plugin that renames all the assets by appending the hash. Then we would just need to replace all the <script>, <img> & <link> tags with <?php get_asset ?> calls.
This is pretty much how Django/Rails handles it.
Seeing as we already use per-page CSS and JS through a section of PHP, this shouldn't actually be that hard. See https://www.alainschlesser.com/bust-cache-content-hash/
Moving to High priority as we are getting browser script caching errors that prevent people from buying elementary.
CSS is all built in Gulp but JS is webpack. This might need two separate manifests, although the PHP should be able to handle that automatically with one function.
I cannot figure out why cache busting does not seem to work for CSS in Gulp. I could rework the CSS to also be done by webpack and it would leverage the same approach, but I wanted to check before I change the whole build process.
CSS moving to webpack would be fine so long as we had feature parity.
Any objections to updating to Webpack 4?
On Sat, Dec 14, 2019, 4:13 PM Lewis Goddard [email protected] wrote:
CSS moving to webpack would be fine so long as we had feature parity.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/elementary/website/issues/2093?email_source=notifications&email_token=AAVNEHWQFIZZRYE6HXBWWQ3QYVEBDA5CNFSM4F6IXUT2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEG4LPMQ#issuecomment-565753778, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVNEHXMETH42JC4ZPEQDITQYVEBDANCNFSM4F6IXUTQ .
@RMcNeely nope!