-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged CSS file name generation #11354
Comments
@pmoreno1980 Are you sure the contents of the file are actually changed, I believe the file name is based on the contents that are in the file. If the contents of the file change, the hash should change as well? |
I'm using a custom theme (porto for Magento 2), i changed some styles in the custom css file that is merged and minify. So supposedly if i change the content the file name should change? thanks for you help |
What's the problem with it? You can find it out from the code, in order to get immediate CSS file update you can enable Static Files Signature. |
@orlangur .. Standard systems use to name minified css and js as hash of the content.. as described above.. If content changes, it is bug of css minifier (i dont know if in magento) or supply of css to that minifier (perhaps cached css before minifying) The name of css or js file names are usually derived as hash of the content because the browsers can cache it properly and change it when developer makes a change. If magento does not change minified name when it changes content it is clearly magento bug. Note that i have not investigated if I can replicate the issue.. i am just commenting on your statement.. i dont believe that this issue needs more update. It needs to be checked by magento developers. |
Here is a PR with related logic but only in one place: https://github.com/magento/magento2/pull/10378/files Before change timestamp was used, probably the same happens in described scenario.
As I mentioned, Sign Static Files feature is used to avoid browser caching issues.
Clearly not. If system works as intended it is not a bug. Marking for recheck by someone who is aware how it is supposed to work. |
@orlangur the Sign Static Files change the path of the file (added the version) but doesn't change the name of the file. it's the same. I need to change the name of the file. thanks for your help |
Why do you need to change specifically a name? Yes, basically it changes URL, if in current implementation file name is not obtained as a hash of file content, such system behavior change is definitely a feature request. |
To force the browser visitors to read the new ccs file. I tested a lot and the static content version in the path it's not enough. The other solution maybe is adding the version in the file like ?v=1.2.3 but I don;t know how the merged min.css file is created. |
Browsers cache URLs, not file paths.
Please provide more details how it can be observed. |
every time that I did a new deploy I have a new version in the URL of course. (fyi, yes i delete the static content before deploy), this is what I see in the source code http://xxxxxxxxx.com/pub/static/version1507067651/_cache/merged/f4ae032b4d845f97179714bb8f1806a7.min.css but as you can see the file has the same name always >f4ae032b4d845f97179714bb8f1806a7.min.css |
Browser is caching full URL http://xxxxxxxxx.com/pub/static/version1507299443/_cache/merged/f4ae032b4d845f97179714bb8f1806a7.min.css, what is the exact problem? |
the problem is that i can see the new url path in the source code but i can't see the changes in the css, only i can see the changes after press Shift + F5. make sense? thanks for your help again |
Yes, return the same content for you until i press Shift+F5? I'm not using Varnish |
@pmoreno1980, thank you for your report. |
While PR getting approval and until it will be included into a release I made module only for Magento 2.2.x but not more than version 2.2.4. Thanks |
Hi @pmoreno1980. Thank you for your report.
The fix will be available with the upcoming 2.2.5 release. |
Hi @pmoreno1980. Thank you for your report.
The fix will be available with the upcoming 2.3.0 release. |
Preconditions
Magento 2.1.7
PHP 7.0
Mysql 5.7
Attributes (attribute sets) with numeric codes
Steps to reproduce
Expected result
Actual result
Why the file name never change f4ae032b4d845f97179714bb8f1806a7.min.css ?
The text was updated successfully, but these errors were encountered: