Page 1 of 1

Custom.css is cached forever

Posted: Mon Jul 23, 2018 11:30 am
by garfy
I add some custom code to custom.css and then clear the cache in phpbb ACM

nothing happens.....custom.css works...it is added to cssstyles main css file....but clearing cache does not affect it....
same as with 3.1 version

Re: Custom.css is cached forever

Posted: Mon Jul 23, 2018 12:03 pm
by HiFiKabin
You also need to clear your browsers cache

Browsers vary but it can usually be accomplished:
  • For Windows and Linux using: Ctrl + F5 or Shift + Reload
  • For Mac using: (Cmd) + R.

Re: Custom.css is cached forever

Posted: Sun Jul 29, 2018 3:46 pm
by v12mike
The problem is that .css that are loaded by the stylesheet.css file are not automatically up-versioned by a cache purge, in the way that most other assets are. This is a fundamental limitation of using a stylesheet.

I recently proposed a patch for phpBB to work around this issue, but it relies on the web server supporting mod-rewrite. See https://tracker.phpbb.com/browse/PHPBB3-15710

There does not seem to be a lot of enthusiam for pulling this patch into phpBB, so I am not sure whether to progress it.

Re: Custom.css is cached forever

Posted: Sun Jul 29, 2018 4:12 pm
by thecoalman
Another option is If you right click and select developer tools there should be option to force it to bypass the browser cache.

You really need to work on this is local environment and then deploy it when you are satisfied. You can insure your visitors get updated version by editing stylesheet.css before deploying it.

Code: Select all

/*  phpBB3 Style Sheet
    --------------------------------------------------------------
	Style name:			prosilver (the default phpBB 3.2.x style)
	Based on style:
	Original author:	Tom Beddard ( http://www.subblue.com/ )
	Modified by:		phpBB Limited ( https://www.phpbb.com/ )
    --------------------------------------------------------------
*/

@import url("normalize.css?v=3.2");
@import url("base.css?v=3.2");
@import url("utilities.css?v=3.2");
@import url("common.css?v=3.2");
@import url("links.css?v=3.2");
@import url("content.css?v=3.2");
@import url("buttons.css?v=3.2");
@import url("cp.css?v=3.2");
@import url("forms.css?v=3.2");
@import url("icons.css?v=3.2");
@import url("colours.css?v=3.2");
@import url("responsive.css?v=3.2");
@import url("custom.css?v=3.2");
Let's suppose you edited custom.css?v=3.2, change to custom.css?v=3.2.1. Upload to your server and purge the cache, when you purge the cache the changes should take effect.

Re: Custom.css is cached forever

Posted: Sun Jul 29, 2018 5:35 pm
by garfy
but I think in 3.2 works kind of ok, in 3.1 it took days till I saw any change......
If you put in your code any existing style sheet, the changes are visible after you clear the cache....but if you use custom css, which seems very logical to do then it takes a little more time to see the changes..

Re: Custom.css is cached forever

Posted: Sun Jul 29, 2018 7:15 pm
by canonknipser
garfy wrote:
Sun Jul 29, 2018 5:35 pm
but if you use custom css, which seems very logical to do then it takes a little more time to see the changes..
that's because css is cached by your browsers cache, not by phpBB cache system. To make changes visible, you need to change the url (which is done by changing the url parameter?v=3.2 to some other value, as thecoalman already mentioned:
thecoalman wrote:
Sun Jul 29, 2018 4:12 pm
Let's suppose you edited custom.css?v=3.2, change to custom.css?v=3.2.1.
This will force your browser to refresh the cached file because it has a different url.

Or, simply clean your browsers cache (hit ctrl + F5)

Re: Custom.css is cached forever

Posted: Sun Jul 29, 2018 7:58 pm
by Lumpy Burgertushie
also, your host may have a cache in place . that is usually what is happening when it takes days for the changes to show.

robert

Re: Custom.css is cached forever

Posted: Mon Jul 30, 2018 8:14 am
by thecoalman
canonknipser wrote:
Sun Jul 29, 2018 7:15 pm
This will force your browser to refresh the cached file because it has a different url.

Or, simply clean your browsers cache (hit ctrl + F5)
What I said was:
You can insure your visitors get updated version by editing stylesheet.css before deploying it.