q2a - Clear CSS cache from browser with CSS versioning

0 votes
194 views
added Dec 18, 2020 in Software & tools by lcjr First Warrant Officer (11,830 points)
edited Dec 29, 2021 by lcjr

Question2Answer script does not cache the CSS, browser does. In order to clear it, you need to add versioning into the CSS.

  1. You need to edit the following file; root/qa-include/qa-theme-base.php line 316 (v.1.7.2). 
  2. Comment the first code and add the CSS versioning as shown below;
    1. // return 'qa-styles.css?'.QA_VERSION;
      
      return 'qa-styles.css?v=2.1';
  3. Apply changes to your .css, and update root/qa-include/qa-theme-base.php to the server. 
  4. Inspect element to double check the changes is in effect.
    1.  <link rel="stylesheet" href="./qa-theme/YOUR_THEME/qa-styles.css?v=2.1">
      

 

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...