0

Is there any way to force versioning of specific assets or media types (like .webp images) on all pages of the CMS? I'd imagine it'd be an extension or something that adds ?ver=xyz type of postfix to HTML and CSS right before it's output, where xyz is set in the admin panel. I can't find anything related to this problem though.

This is to refresh browser cache on demand without the necessity of renaming files.

3 Answers 3

3

In Joomla 3 for js and css assets you can add 'version'=>'auto' to the attributes of addStyleSheet and addScript:

$document->addStyleSheet("...demo.css", array('version'=>'auto'));

as described in https://docs.joomla.org/J3.x:Adding_JavaScript_and_CSS_to_the_page#$options_and_$attributes_Parameters

In Joomla 4 the web asset manager does this by default.

I'm not aware of any core joomla functionality which adds versioning to images and other types of media, but you may be able to find a joomla extension which supports this.

1
  • Thanks. I'm looking primarily for images and and automatic way to do it so that it covers also random extensions.
    – Destroy666
    Mar 20 at 21:45
0

You could write a small plugin, or use a plugin that can replace HTML code on the fly.

Let it search and replace all instances of .webp" in the HTML source with .webp?your-own-version-number".

0

Responsive images will do that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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