Do not cache CSS

Do not cache CSS

  

Hey guys

Quick question here: is there any way to disable caching CSS?

We've released the application we're currently working on to a set of end-users to gather some feedback on both UI and look and feel and we need to tell each one to clean the cache (ctrl+F5) for them to see the changes we've made


Regards,

Ângelo Sousa

Hi,

If you'r loading the CSS via file, you can add a parameter in front of the file name, example "CSSModule/Bootstrap.css?" + Site.CSSVersion. You will still need to change the site property everytime you change the css.

Best regards,

João Nobre

João Nobre wrote:

Hi,

If you'r loading the CSS via file, you can add a parameter in front of the file name, example "CSSModule/Bootstrap.css?" + Site.CSSVersion. You will still need to change the site property everytime you change the css.

Best regards,

João Nobre

We have similar issues from time to time and do not use loading css via a file, so this solution unfortunately does not apply to our case.


Hello João

Thanks for your answer


We are defining the CSS in the stylesheet, not through file


Regards,

Ângelo

Hello Ângelo 


Actually using file with versioning is a good option as the application will fetch new css file after deployment.


Please check : https://stackoverflow.com/a/1011636


Hope this helps :)

Thanks and Regards,
Atul Patel

Hi Angelo.

Which version of OutSystems are you using?

Nowadays OutSystems has the versionnumber, as suggested by Atul, already in the referenced files (the Stylesheet is also referenced) and when a file is published, the version number is updated.

I can change my CSS, publish the CSS and reload my page normally (F5) and see the changes.

Kind regards,

Remco Dekkinga

Hello Remco


I'm using P10.

But this only works when you use a file to define the CSS, right? If we're using the stylesheet, we need to force the cache clean (ctrl+F5) or wait for it to automatically refresh


Regards,

Ângelo

Hi Angelo,

The stylesheet from OutSystems is also a file called "Theme.ModuleName.Css?versionnumber" and should be updated on every publish of your module.

Are you using two different modules where one module (UI) is referencing another module (Theme)?

In this case you need to refresh references of the UI module and publish UI after you have changed the CSS in the Theme module.

When this is not the case, can you share the revisionnumber (10.0.xxx.0) of your Service Studio and Platform version and a part of the rendered sourcecode?

Kind regards,

Remco Dekkinga

Hello Remco

Yes, we have a big part (not all, for testing purposes) of the CSS in a separate module that's being consumed on all of the UI modules.

Of course we are refreshing all dependences when we change the CSS on the Theme module, but some of them seem to only take effect on the browser once we force the ctrl+F5

Regards,

Ângelo

The problem (as we have it over here) is that the number doesn't seem to increase every time. For instance, we have our own Icon webblock. In there you can use a static value and a size, selectable from a static. Every time we receive new icons, we add them to the static and update the CSS of the icon webblock with the CSS for all icons. This webblock is inside our Layout eSpace. After publishing and refreshing my other espaces, I see that the number for the CSS for both Layout and the Icon CSS is the same, but not updated from the last version (so before changes it said Layout.css?599 and Layout/Widgets/Icons.css?599). This causes the problem for us, since of course the browser doesn't know that the css has actually changed if this number is the same. How can we force this number to be increased? Do we need to change something in the actual Layout.CSS as well for it to actually update the number? Or does changing css never actually update the number?

Thanks in advance.

Ângelo Sousa wrote:

Hello Remco

Yes, we have a big part (not all, for testing purposes) of the CSS in a separate module that's being consumed on all of the UI modules.

Of course we are refreshing all dependences when we change the CSS on the Theme module, but some of them seem to only take effect on the browser once we force the ctrl+F5

Regards,

Ângelo


We have the exact same problem. Have you found any solution for this?