busting cached stylesheets to force CSS changes

On this forum you can see a list of new features requested by users and you can also cast your own vote (you need to login to vote).
Post Reply

Ability to force a cache refresh on the client side

Yes
0
No votes
No
0
No votes
Don't Understand
0
No votes
 
Total votes: 0

joben
Posts: 248
Joined: Wed Nov 06, 2019 9:49 pm
Location: Sweden
Contact:

busting cached stylesheets to force CSS changes

Post by joben »

Quite often when publishing a new version, I have also made changes to the CSS (located in Custom/CSS/appname/style.css).
However, the cache is so strong that these changes are not being loaded.
I have even tried to change the name from style.css to style2.css, which has not worked.
The only way for the user to get the new changes is to do a hard refresh (CTRL+SHIFT+R).
It just isn't feasible to tell users they have to make a manual action.
Rather than having to make some manual Tomcat changes, it would be really nice to have some cache busting functionality.
Regards, Joakim

Image
hpl123
Posts: 2646
Joined: Fri Feb 01, 2013 1:13 pm
Location: Scandinavia

Re: busting cached stylesheets to force CSS changes

Post by hpl123 »

1+ for something like this automated and this should be possible manually, take a look at startup.html and how the aware script is versioned and if that works, a similar approach should work for CSS. I have not gotten around to testing and implementing this so I can't tell you for sure that it works.
Henrik (V8 Developer Ed. - Windows)
joben
Posts: 248
Joined: Wed Nov 06, 2019 9:49 pm
Location: Sweden
Contact:

Re: busting cached stylesheets to force CSS changes

Post by joben »

hpl123 wrote: Tue Dec 03, 2024 8:35 am take a look at startup.html and how the aware script is versioned and if that works, a similar approach should work for CSS.
I suppose you refer to this part:

Code: Select all

src="aware_kendo/aware.js?V3123"
There is no doubt in my mind that it would be possible to do some configuration changes to make the CSS cache less sticky, or forcing a dummy variable making the link different each time. Or perhaps just manually increasing URL version parameter.
I just want to make sure that the fix is as permanent as possible, so that upgrading or installing new AwareIM instances does not increase complexity.
I wish to avoid modifying core files. But if anyone has a solution that can reside inside the Custom JS folder, then I would say that is good enough, in fact it would be a major improvement.
Regards, Joakim

Image
hpl123
Posts: 2646
Joined: Fri Feb 01, 2013 1:13 pm
Location: Scandinavia

Re: busting cached stylesheets to force CSS changes

Post by hpl123 »

joben wrote: Tue Dec 03, 2024 9:18 am
hpl123 wrote: Tue Dec 03, 2024 8:35 am take a look at startup.html and how the aware script is versioned and if that works, a similar approach should work for CSS.
I suppose you refer to this part:

Code: Select all

src="aware_kendo/aware.js?V3123"
There is no doubt in my mind that it would be possible to do some configuration changes to make the CSS cache less sticky, or forcing a dummy variable making the link different each time. Or perhaps just manually increasing URL version parameter.
I just want to make sure that the fix is as permanent as possible, so that upgrading or installing new AwareIM instances does not increase complexity.
I wish to avoid modifying core files. But if anyone has a solution that can reside inside the Custom JS folder, then I would say that is good enough, in fact it would be a major improvement.
Yes, that is the one and versioning can be done like you did with different file names and should theoretically work as it is a brand new file referenced. As far as I know, all Aware do with the files in the Custom folder(s) is automatically add the link tags etc. for the files to startup.html at runtime but Aware is maybe doing something else behind the scenes if this doesn't work for you.
Henrik (V8 Developer Ed. - Windows)
Post Reply