Need to flush browser cache to see CSS changes

Hi everyone !
Glad to meet the Omeka community !

I’m just taking a new job in a french library that use Omeka-S and a modified version of Omeka default theme 1.6.4

I just wanted to make some CSS ajustments.

Instead of modifying with sass, they directly make changes in the style.css file. I know, it’s bad but that’s not why I’m here.

I do small changes (in style.css) and everything goes fine but I need to flush my browser cache to see any changes (what i can’t ask all users).

I’ve checked the documentation and this forum but with no luck.

Is there a way in the back office to force browsers to load the last version of CSS ?

Coul’d you point me to the good direction please ?
Many many thanks !

Gilles

The easiest way as far as I know to force all browsers to re-load the updated css is to make reference to css version in the theme file. This is of course applies more widely, but specifically in Omeka S, I suppose that you have a pointer to your css file in themes/your_theme_name/view/layout/layout.phtml (obviously replace your_theme_name with the folder name of your theme).

If you are really just editing style.css, just replace style.css with style.css?version=01 wherever it is mentioned there. And remember to bump version (style.css?version=02 , etc.), every time you deploy your updated css.

Editing the original css file is likely to cause issues when you will eventually update the underlying theme.

A slightly less invasive option even without bothering with sass is to have a “custom.css” file, and have it loaded after the others at the end of head. So just before </head>, add a line with something like:

<link rel="stylesheet" href="/themes/your_theme_name/asset/css/custom.css?version=01">

And custom.css will take precedence over the default css.

Hope this helps.

Thank you Giocomai! It helped me for sure.

I can still clear my browser cache for small ajustments then deploy the css with the ?version trick when all is done. Great !

Best regards,
Gilles

1 Like