News:

SMF 2.1.6 has been released! Take it for a spin! Read more.

Main Menu

Minified Files Aren't Deleted Straight Away

Started by Darkness7148, May 08, 2022, 05:18:42 AM

Previous topic - Next topic

Darkness7148

I noticed when I updated some CSS files in the theme directory, that people's minified files weren't been deleted straight away. So I took a look and it seems this function deleteAllMinified in Subs.php doesn't run very often. I've got around it by running the Weekly Maintenance task which triggers it but I would have expected that out-of- date minified files to be deleted straight away as soon as I updated a CSS file.

Arantor

No, they're not - instead a new one is generated with a new hash.

The reason why doing the housecleaning is a bad idea is that it would end up being something that happens potentially every page load, which is just unnecessary busywork given that we're usually talking on the order of a few hundred KB on the server even on a busy site.

There is honestly no need to run the task more frequently than weekly unless you're in such low disk space that a few hundred KB is make-or-break time (in which case, get a better host)
Holder of controversial views, all of which my own.


Darkness7148

Oh, it just seemed to me that people were still using the same minified files even after I updated the CSS. Some users were complaining that things didn't look quite right because the new CSS wasn't being reflected.

Arantor

Even if you get the files regenerated, there's no guarantee that the browser won't simply ignore you and keep whatever version it has cached. Especially if your host has Varnish set up.

The minified files *should* be created with a new name if the timestamp changes, but even *that* is cached by the operating system and may not be correct.
Holder of controversial views, all of which my own.


Sesquipedalian

You should turn off minimization while working on CSS or JavaScript files.
I promise you nothing.

Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

Advertisement: