Each update merged css/js file name each time the merge cache is cleared. #2152
Replies: 5 comments
-
Isnt there a N98 extension that already does this? Woul'd like to this this in. |
Beta Was this translation helpful? Give feedback.
-
I remember something it was using the hash of the filenames, not the contents for getting the final filename. Magento2 and some of the M1 solutions maintain a config value, which they change to cause a new hash. Questionn is, if we should solve this in the core, or some extra module. I would suggest to solve it as part of the core |
Beta Was this translation helpful? Give feedback.
-
Magento should 100% be capable of invalidating the end-user's cache by providing a new file name when flushing JS/CSS cache |
Beta Was this translation helpful? Give feedback.
-
This should definitely just be how the core works. I think a good approach is to hash the file names and also the last modified timestamps of the files as well. This way when the files are updated the timestamp changes and so in turn does the hash as well. The timestamps can be cached to avoid more disk access, although PHP/Linux is probably already caching the file stats in memory anyway. |
Beta Was this translation helpful? Give feedback.
-
Please duble check if Magento is not clearing the cache too often. We don't want to force users to download new files when there was no change in content. |
Beta Was this translation helpful? Give feedback.
-
Magento tries to updated merged js/css file names if it detects that there has been a file change. However, I've noticed in our application that it does not do a good job of this.
It makes sense that each time a developer requests that the clear merged assets be executed, that the expectation is to cache bust for end users. Therefore a new merged asset file name should be generated.
Beta Was this translation helpful? Give feedback.
All reactions