Page 1 of 1
Auto Version for Stylesheet and JavaScript files
Posted: Tue Apr 03, 2018 3:09 pm
by mobhar
We often must to customize the certain code in .css and .js files and then re-upload those files to the production server. Unfortunately, the End-Users cannot download and use those files via their browser, if they do not do the hard-refresh/reload the current page, moreover, for some cases, they have to reload those .css andd .js files via View Page Source of the browsers.
To overcome those issues, then please add the ability to add the sufix for each .css and .js files. So, instead of displaying this:
phpcss/demo2018.css
that would be better if we use such the following technique:
phpcss/demo2018.css?v=1522739106
The last format will auto detect the latest version. End-Users do not need the hard-refresh/reload again.
Thank you.
Re: Auto Version for Stylesheet and Javascript files
Posted: Fri Apr 27, 2018 2:37 am
by xxltomcat
Re: Auto Version for Stylesheet and Javascript files
Posted: Mon May 30, 2022 8:11 pm
by Adam
Re: Auto Version for Stylesheet and JavaScript files
Posted: Tue May 31, 2022 1:20 pm
by philmills
Re: Auto Version for Stylesheet and JavaScript files
Posted: Thu Jun 16, 2022 4:00 am
by Adam
+1 ...but:
a) there's no need for the "v=" part - just a number i.e. "?1234567" as the query is sufficient
b) it's better to use the file timestamp as in the example I posted so that manual changes to .css and .js files are taken into account - this is especially important for files that are not auto-generated
Re: Auto Version for Stylesheet and JavaScript files
Posted: Sun Jun 19, 2022 2:05 pm
by stefano
Re: Auto Version for Stylesheet and JavaScript files
Posted: Tue Sep 13, 2022 10:03 am
by Webmaster