MyBB Community Forums

Full Version: Theme CSS Cache Query String Hashes to bust caches
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I think that mybb should include a query string hash/version (maybe just an md5 or sha1 hash of the CSS file?) at the end of a CSS file so that every update it can change to bust both browser caching and cloudflare caching, this would be similar to what you already do for the javascript files.

For example:

<link type="text/css" rel="stylesheet" href="https://mybb.solutions/cache/themes/theme3/global.min.css" />
would become
<link type="text/css" rel="stylesheet" href="https://mybb.solutions/cache/themes/theme3/global.min.css?v789" />

Thoughts?
Would make sense, not sure why we have versions for JS but not for CSS.
I agree with this, but like the discussion regarding JavaScript files, what we append should not reveal the version of MyBB in use.
(2017-11-20, 07:14 PM)laie_techie Wrote: [ -> ]I agree with this, but like the discussion regarding JavaScript files, what we append should not reveal the version of MyBB in use.

It would make sense to use the same value as that used for JS files. As in the discussion around JS, this would be a timestamp of when the last install/upgrade happened.
Awesome glad to see people liked one of my suggestions Smile

This little hack is kinda annoying for my theme devs to use :/
[Image: 8SdZlfh.png]
If you run Cloudflare you should use their cache purging. You can do it on a per file or per site basis.
(2017-11-20, 08:45 PM)labrocca Wrote: [ -> ]If you run Cloudflare you should use their cache purging. You can do it on a per file or per site basis.

I already do that, however when developing live that can be a time consuming project, I don't like using hacks as pictured above to share access to Cloudflare, a query string on the last update to the CSS file could reduce a lot of these issues. The same is already done with js, so why not css?
Instead of a hash, why not use the timestamp? Referring to TIME_NOW.
(2017-11-20, 09:10 PM)Sazze Wrote: [ -> ]Instead of a hash, why not use the timestamp? Referring to TIME_NOW.

As I said above, the current plan is to use a timestamp of when the board was last installed/updates, and which then changes when a stylesheet is edited.
Quote:I already do that, however when developing live that can be a time consuming projec

Use Cloudflare development mode until you're done with live development and then purge the files required from cache.
Pages: 1 2