CSS/JS auto versioning based on last git commit hash #3943
fballiano
started this conversation in
Extensions & Modules
Replies: 3 comments 9 replies
-
Nice👍🏻 I use a very similar solution, but based on a simple time-based version string. This eliminates the need for .git repository in production and the result is nearly the same if cache is not flushed too often. |
Beta Was this translation helpful? Give feedback.
4 replies
-
I use this: https://github.com/jreinke/magento-suffix-static-files |
Beta Was this translation helpful? Give feedback.
0 replies
-
Having .git folders on prod seems scary. Why not |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everybody,
if you use long browser cache lifetime (to make google happy) and you have to flush your CDN every time you modify one of your CSS/JS then this module could be for you.
https://github.com/fballiano/openmage-cssjs-versioning
I've used this solution for many years for all my customers but I never packaged it in a "standardized" way until now.
Hope this may help somebody out there.
Quick description:
Adds ?v= to all your CSS/JS and the value of v is the last git commit hash (or a timestamp if the git approach fails).
This way CDN updates and also browsers will download the new version of the files.
Beta Was this translation helpful? Give feedback.
All reactions