When CSS and/or JS merging in turned on in the backend it's busting cache by adding the last modified date as a query parameter to the merged css and js urls. For example:
<link rel="stylesheet" href="https://yourstore/media/css_secure/3c878a261153f59c071403f9d8fad910.css" />
<script src="https://yourstore/media/js/3c878a261153f59c071403f9d8fad910.js"></script>
Will be:
<link rel="stylesheet" href="https://yourstore/media/css_secure/3c878a261153f59c071403f9d8fad910.css?v=1480691261" />
<script src="https://yourstore/media/js/3c878a261153f59c071403f9d8fad910.js?v=1480691261"></script>
Browsers cache css and js files. So when you change such a file it's possible the changes won't take effect. You could clear your browser cache or do a "hard refresh" but all your website visitors should do the same, not really user friendly. By changing the filename after each edit fixes this, so why not change it automatically when a file is changed? That's what this module do!
And no, the the filename hash generated by Magento when js/css merging is enabled does not do this already because it's based on the filenames, hostname and port: md5(implode(',', $files) . "|{$hostname}|{$port}") . '.css';
.
- Use modman:
modman clone https://github.com/justbetter/magento1-cache-buster.git
- Manually: download, unzip and copy.
This module overrides just one Magento model but uses the parent function to ensure upgradability. It's tested on Magento 1.9.3.7 but should work on every older version.
Please create a issue or a pull request.
We’re a innovative development agency from The Netherlands building awesome websites, webshops and web applications with Laravel and Magento. Check out our website justbetter.nl and our open source projects.