Author Topic: Clear the cache after changing the VM design  (Read 1274 times)

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 27730
  • Always on vacation
    • Jenkin Hill Internet
Re: Clear the cache after changing the VM design
« Reply #15 on: May 20, 2020, 13:37:38 pm »
If it is a browser cache issue, ie when you clear the browser cache you can see the changes, then it is the browser that must be attacked. I use 3 different browsers to check site changes and do see browser cache problems periodically. Does not bother me, though. When I notify a client that I have made changes to a page on their site I always include a ctrl+f5 instruction.

What about https://developer.mozilla.org/en-US/docs/Web/API/Cache/delete
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Currently using VM 3.8.0 10314 on Joomla 3.9.16 PHP 7.0.33

Iryn3l

  • Beginner
  • *
  • Posts: 35
  • A beginner
Re: Clear the cache after changing the VM design
« Reply #16 on: May 20, 2020, 14:29:33 pm »
I renamed template.css (works like this)
it's the only solution for me
Thank You

pinochico

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 379
    • MiniJoomla
  • VirtueMart Version: 3
Re: Clear the cache after changing the VM design
« Reply #17 on: May 20, 2020, 16:19:25 pm »
Is not good solutions.
You must add timestamp for JS and CSS programmatically and setup Expires in httacess.
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds from products, orders and database table
Virtuemart Email Manager - customs email templates

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4329
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Clear the cache after changing the VM design
« Reply #18 on: May 21, 2020, 02:10:40 am »
I use versionning. For .eg template.css?v1.0.0 to prevent old css or javascript in the browser cache
Or template.1.0.0.css

pinochico

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 379
    • MiniJoomla
  • VirtueMart Version: 3
Re: Clear the cache after changing the VM design
« Reply #19 on: May 21, 2020, 03:05:10 am »
Patrick:
Quote
I use versionning. For .eg template.css?v1.0.0 to prevent old css or javascript in the browser cache
Or template.1.0.0.css

Interestingly.
I just don't know how to do it, when we have 382 changes in css in the last six months and it is generated automatically from less files by the T3 framework.
That probably doesn't work, does it?

Timestamp sounds better to me, I don't have to deal with 382 versions, because I set it up in php once and I don't care anymore.
It may be the right option for manually created css, but I doubt it is a universal solution for us as well.
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds from products, orders and database table
Virtuemart Email Manager - customs email templates

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4329
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Clear the cache after changing the VM design
« Reply #20 on: May 21, 2020, 09:40:52 am »
@Pinochico
You can add the versioning as a parameter in your template for .eg, but in my case, it's more when i add own css or javascript files in my extensions.

pinochico

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 379
    • MiniJoomla
  • VirtueMart Version: 3
Re: Clear the cache after changing the VM design
« Reply #21 on: May 21, 2020, 10:24:10 am »
Patrick:

Thanks, templates form Joomlart (base on T3 framework - we use it), create verisoning self - after any change in less or JS files, then generate css and js file with generated number of version.
So I don't care about this :)
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds from products, orders and database table
Virtuemart Email Manager - customs email templates

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3165
  • VirtueMart Version: 3.6.11
Re: Clear the cache after changing the VM design
« Reply #22 on: May 21, 2020, 16:13:50 pm »
Just thought I would add my ten cents worth:

As far as I am aware - "managing versions" requires a very small one time effort using Joomla native support and letting php (at load time) add a differentiator for version.  I dont want my editor or myself to be responsible for versioning.

When I upload a css or js file to my live server, I want all visitors to get this version and for any prior cached versions to become irrelevant. 

Joomla allows for this:-

Code: [Select]
$document->addStyleSheet("...demo.css", array('version'=> yourversionstuffhere etc..
I want a "code and forget" function.

So just adjust  - "yourversionstuffhere" -  and create an appended version that includes php's file content modified information.

Code: [Select]
$doc->addStyleSheet('...yourcssfile.css',  array('version'=> 'ver='.date("YmdHis", filemtime('...yourcssfile.css'))));
result = yourcssfile.css?ver=20200501104344

Of course, you must provide the correct path to your css file!

Exactly the same approach can be used for js files.

Thereafter - everytime you upload the file, it will be re-versioned - no matter how many times you upload it.

regards
A

Joomla 3.9.18
php 7.3

pinochico

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 379
    • MiniJoomla
  • VirtueMart Version: 3
Re: Clear the cache after changing the VM design
« Reply #23 on: May 21, 2020, 17:42:20 pm »
AH:

but you don't use automatic generated finally css from template T3-framework, isn't it?
You write info only about our custom css added for component, module, fonts, but not from bootstrap T3-framework template :)
That is not correct for me, I have only one output css file minimized from every css files on the eshop and minimized version generated template automatically :)

Yes, about version by date and time in php  I wrote in my previous post, that is correct, thanks for your ode.
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds from products, orders and database table
Virtuemart Email Manager - customs email templates

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3165
  • VirtueMart Version: 3.6.11
Re: Clear the cache after changing the VM design
« Reply #24 on: May 21, 2020, 20:38:49 pm »
Pinochio
Quote
That is not correct for me, I have only one output css file minimized from every css files on the eshop and minimized version generated template automatically

And that is a good thing to have.

However if you have your own template, auto generated versioning may not exist and can be a pain!

So i wanted to add another persons view for those who may be wondering why customer browser caching is happening (possibly as a result of  apache server mod_expires )
And what they might be able to do to resolve it :-)
regards
A

Joomla 3.9.18
php 7.3

pinochico

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 379
    • MiniJoomla
  • VirtueMart Version: 3
Re: Clear the cache after changing the VM design
« Reply #25 on: May 21, 2020, 23:07:04 pm »
AH:

thanks, that is right :)
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds from products, orders and database table
Virtuemart Email Manager - customs email templates

Iryn3l

  • Beginner
  • *
  • Posts: 35
  • A beginner
Re: Clear the cache after changing the VM design
« Reply #26 on: May 26, 2020, 18:48:49 pm »
Is not good solutions.
You must add timestamp for JS and CSS programmatically and setup Expires in httacess.


why isn't it a good solution?

pinochico

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 379
    • MiniJoomla
  • VirtueMart Version: 3
Re: Clear the cache after changing the VM design
« Reply #27 on: May 26, 2020, 23:13:47 pm »
Today I optimalized one onepage website.
And created cca. 48 update css files.

What do you think?
48 x manually change file names or automatically added timestamp? :)
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds from products, orders and database table
Virtuemart Email Manager - customs email templates

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3165
  • VirtueMart Version: 3.6.11
Re: Clear the cache after changing the VM design
« Reply #28 on: May 27, 2020, 09:47:48 am »
Quote
why isn't it a good solution?

Because it is manual and you have to create a new name every time!

With a date/time option in your template/modules - you dont need to change the filenames - just upload the file

regards
A

Joomla 3.9.18
php 7.3