0

I am new to Joomla and just downloaded a template (from my company) and deployed it on XAMPP.

When I try to edit the CSS and refresh the page, the css does not get updated. I have tried clearing the cache and refreshing, but no such luck.

  • Welcome to JSE. Which template are you using? Which CSS file are you trying to edit? Where did you edit it? – Lodder Jun 23 at 6:57
  • i am using a custom template from my company, i inspected the element in the browser and edited the respective css file in my localhost – advait-varma Jun 23 at 6:59
  • Welcome to JSE, please take our tour. Have you seen this? Xampp and Ampps don't reload files when changed And this page talks about cache config settings: joomlashack.com/blog/joomla/… And here is Joomla docs page regarding caching: docs.joomla.org/…. – mickmackusa Jun 23 at 6:59
  • Are you absolutely certain that your edit file being saved? ...this is a "sanity check" request for confirmation from you. Is the css file modification timestamp changed in your system? – mickmackusa Jun 23 at 7:08
  • Yes, i just checked once more and i can see the timestamp, i even opened the file again to check if the changes were made and it was there – advait-varma Jun 23 at 7:12
0

Joomla's default Protostar template includes CSS files with

JHtml::_('stylesheet', 'template.css', array('version' => 'auto', 'relative' => true));

The ['version' => 'auto'] adds a media version MD5 hash as token to the file. The media version is regenerated by Joomla whenever anything is installed on the Joomla instance. See https://docs.joomla.org/J3.x:Adding_JavaScript_and_CSS_to_the_page#.24options_and_.24attributes_Parameters

The media version does NOT change when you make changes in your CSS. You could add your own timestamp to force a browser to re-load the CSS instead using it from cache.

In your template's index.php you could add something like:

use Joomla\CMS\HTML\HTMLHelper;

HTMLHelper::_(
    'stylesheet',
    'your-css-file.css',
    [
        'version'  => filemtime(JPATH_THEMES
            . '/your-template/css/your-css-file.css'),
        'relative' => true
    ]
);

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.