function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Gopala KovilurGopala Kovilur 

Changes to static resource file not getting applied immediately or consistently

In my Dev Org, I downloaded a static resource (as zip), changed the css in it  and upload back the static resource successfully. All I did was change value of a "max-height" style attribute from X value to Y.

Post I upload the updated static resource file, the updated style value is NOT applied immediately. Using Developer Toolbar, when I check the style, it still shows the old value for the style attribute.
 
In Chrome, the .scss file  (I guess generated dynamically from .css file) does not have updated style value. Is there any SFDC background job/process that converts .css file to .scss file? If so, how do we make it take this updated style immediately?
 
To reflect the change, sometimes it takes a day . Sometimes its 15-20 minutes. Sometimes it does not get applied at all. This behavior is shown across Chrome, FireFox, Edge, IE and on Android phone.

 What step am I missing here ?

 
Arp_SFDCArp_SFDC
Hi Gopala

Sometime when we refresh page then browser reload that page and included resources from cache not from server, So to get ride of this either we need to force refresh page using ctrl+F5 OR Alternative see this link to manage cache programatically 
https://help.salesforce.com/articleView?id=sites_caching.htm&type=0

Kindly mark this as best answer if it's help.

Thanks
Arpit
Gopala KovilurGopala Kovilur
Thanks Arpit. Tried Ctrl+F5 as we all as Hard Reload options in Chrome, Edge and IE. Even tried on a different laptop. Still same result. Somewhere in server, it has cached the old version and is not updating the CSS inspite of successful upload of Static resource.
Arp_SFDCArp_SFDC
Hi Gopala 

Please Check your cache control setting in static resource if it is set to private then make it public and Let me know its help or not.
User-added image
Thanks
Arpit
Gopala KovilurGopala Kovilur
Cache Control is already set to Public. Other things I did are as below, which should negate the effect of Cache 1. In the visualforce page, used the URLFOR() call that negates cache setting 2. In browser, cleared cache. Still Opened a New Incognito window (negate cookies) and did a “Empty Cache and Hard Refresh” in F12. 3. Tried different browser and machines Not sure what I am missing.
Arp_SFDCArp_SFDC
Please post code how you are including static resource.
Gopala KovilurGopala Kovilur
This main.css also has corresponding main.css.map file. But I am updating only main.css. Is that what are you asking for?
Arp_SFDCArp_SFDC
No I am talking about your page code so please post your code which contain how you including static resource.

are you using static resource on site?

Thanks
Arpit
Gopala KovilurGopala Kovilur
Here it is. Are you expecting something different? If so, please share a sample.
Arp_SFDCArp_SFDC
Are you using this on site?

Code for which I am talking about

<apex:stylesheet value="{!$Resource.stylesheet_red}"/>

Thanks
Arpit
Gopala KovilurGopala Kovilur
The
Gopala KovilurGopala Kovilur
Hi Arpit, I found the root of the problem, but not sure how to solve it. Using Developer tools, I found the path of my css resolves to below path, calling it path A https://mysite.myOrg.force.com/resource/1504186155000/myStaticResource/css/main.css Whereas “view file” link of static resource has below path, calling it path B. https://mysite.myOrg.force.com/resource/1508479344000/myStaticResource/css/main.css If you see the number part in Path A and Path B are totally different. Now how to make salesforce reference path B instead of A? From: Kovilur, Gopala (US - Hyderabad) Sent: Friday, October 20, 2017 2:55 PM To: 'reply' Subject: RE: (Salesforce Developers): New reply to your question. The
Arp_SFDCArp_SFDC
Hi Gopala,

If you are using site then please set cache="false" in apex:page attribute If it is still not worked then please send code how you are including stylesheet on page.

Thanks
Arpit