Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
915 views
in Themes by

Hi 

I am trying to change colors in SnowFlate Theme

I edited qa-theme/SnowFlat/qa-styles.css

by changing the color form blue to green in the main heading:

.qa-main-heading {

position: relative;

margin: 0 0 5px;

padding: 8px 52px 8px 20px;

background: #1C916A;

color: #fff;

}

I tried this change on firefox inspector and it does well 

but on the site nothing changes

where is the problem?

1 Answer

+8 votes
by
selected by
 
Best answer

This seems to be some kind of cache issue. Follow these steps (assuming Google Chrome):

1. Press CTRL + SHIFT + I while browsing the web page (this should open the inspector)

2. Press CTRL + SHIFT + R (this should refresh the page and clear the cache)

If it is working now, then it is confirmed it is a (local) cache issue. If it is not, it could still be the server caching the CSS file

3. The programmatic way to avoid the CSS from being cached in the server is changing the CSS URL. That should fool the server cache and force a new download of the CSS file. This approach would also fix the issue for all users (not just the ones that followed steps 1 and 2). In order to change the URL you should:

  a. Edit file qa-theme/SnowFlat/qa-theme.php

  b. Add or merge this function:

public function css_name() {
    return 'qa-styles.css?' . QA_VERSION . '_1';
}

  c. Keep the _1 for the first time. Each time you make a change to the CSS make sure to increase the number. It should look like _2 next time.

by
Note that the developer tools (at least in Firefox) have a setting to temporarily disable local caching while the toolbox is open. In the toolbox toolbar click the 3 dots, then "Settings", scroll down to "Advanced settings" and check "Disable HTTP Cache (when toolbox is open)".
by
Thanks A Lot
by
public function css_name() {
    return 'qa-styles.css?' . QA_VERSION . '_1'.time();
}
by
@kuaza That's not a good idea. On one hand, there is no need for the '_1'. On the other hand, if you are constantly generating a new URL for the CSS then it won't ever get cached which will increase server load and result in a "slower" user experience
by
No I did it for one time only, and I will not use it again, will that make a problem?
by
It will just not use the cached version as long as you keep recreating the URL. If you rolled the change back, then you can consider the issue as fixed
...