Skip to content
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

Closed
pmoreno1980 opened this issue Oct 10, 2017 · 18 comments
Closed

Merged CSS file name generation #11354

pmoreno1980 opened this issue Oct 10, 2017 · 18 comments
Labels
Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line good first issue Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release

Comments

@pmoreno1980
Copy link

Preconditions

Magento 2.1.7
PHP 7.0
Mysql 5.7
Attributes (attribute sets) with numeric codes

Steps to reproduce

  1. Store >> configuration > advanced > developer
  2. Merge and minify CCS & JS
  3. deleted static content & deploy the static content again

Expected result

  1. change the CCS merged file name

Actual result

  1. always the same file name , example

Why the file name never change f4ae032b4d845f97179714bb8f1806a7.min.css ?

@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label Oct 10, 2017
@paales
Copy link
Contributor

paales commented Oct 10, 2017

@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?

@pmoreno1980
Copy link
Author

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

@orlangur
Copy link
Contributor

Why the file name never change f4ae032b4d845f97179714bb8f1806a7.min.css ?

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.

@scholtz
Copy link

scholtz commented Oct 11, 2017

@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.

@orlangur
Copy link
Contributor

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.

because the browsers can cache it properly

As I mentioned, Sign Static Files feature is used to avoid browser caching issues.

If magento does not change minified name when it changes content it is clearly magento bug.

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.

@pmoreno1980
Copy link
Author

@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

@orlangur
Copy link
Contributor

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.

@pmoreno1980
Copy link
Author

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.

@orlangur
Copy link
Contributor

Browsers cache URLs, not file paths.

I tested a lot and the static content version in the path it's not enough.

Please provide more details how it can be observed.

@pmoreno1980
Copy link
Author

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
http://xxxxxxxxx.com/pub/static/version1507232359/_cache/merged/f4ae032b4d845f97179714bb8f1806a7.min.css
http://xxxxxxxxx.com/pub/static/version1507232880/_cache/merged/f4ae032b4d845f97179714bb8f1806a7.min.css
http://xxxxxxxxx.com/pub/static/version1507299443/_cache/merged/f4ae032b4d845f97179714bb8f1806a7.min.css

but as you can see the file has the same name always >f4ae032b4d845f97179714bb8f1806a7.min.css

@orlangur
Copy link
Contributor

Browser is caching full URL http://xxxxxxxxx.com/pub/static/version1507299443/_cache/merged/f4ae032b4d845f97179714bb8f1806a7.min.css, what is the exact problem?

@pmoreno1980
Copy link
Author

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

@pmoreno1980
Copy link
Author

pmoreno1980 commented Oct 11, 2017

Yes, return the same content for you until i press Shift+F5? I'm not using Varnish

@magento-engcom-team magento-engcom-team added the Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed label Dec 4, 2017
@magento-engcom-team
Copy link
Contributor

@pmoreno1980, thank you for your report.
We've created internal ticket(s) MAGETWO-84966 to track progress on the issue.

@magento-engcom-team magento-engcom-team added 2.1.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Dec 4, 2017
@sashas777
Copy link
Contributor

@pmoreno1980 @scholtz

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.
Maybe it would help you as well: https://github.com/sashas777/merged-css-issue

Thanks

@magento-engcom-team magento-engcom-team added the Fixed in 2.2.x The issue has been fixed in 2.2 release line label May 15, 2018
@sidolov
Copy link
Contributor

sidolov commented Jul 12, 2018

@sidolov sidolov added the Fixed in 2.3.x The issue has been fixed in 2.3 release line label Jul 12, 2018
magento-engcom-team added a commit that referenced this issue Jul 12, 2018
…neration #16663

 - Merge Pull Request #16663 from mageprince/magento2:2.3-develop-PR-port-15144
 - Merged commits:
   1. 2816764
   2. 2d31c1d
   3. e7677e8
   4. ca3c79c
   5. 311f8ca
   6. 1782c54
   7. 94e0e25
   8. 831e58c
   9. 742ad8c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line good first issue Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release
Projects
None yet
Development

No branches or pull requests

8 participants