-
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
Fix some nested extends have been ignored at output #31793
Fix some nested extends have been ignored at output #31793
Conversation
Hi @mrtuvn. Thank you for your contribution
❗ Automated tests can be triggered manually with an appropriate comment:
You can find more information about the builds here ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review. For more details, please, review the Magento Contributor Guide documentation. 🕙 You can find the schedule on the Magento Community Calendar page. 📞 The triage of Pull Requests happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket. 🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel ✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel |
@magento run all tests |
I'm pretty sure functional and web API tests can't be failing because of CSS changes. Also, test results look not related |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔ Approved.
Failing tests looks not related to changes form this PR.
Hi @ihor-sviziev, thank you for the review. |
86b7227
to
cd2253c
Compare
For compatible i don't bring media-common mixin to blank theme only apply for luma and extends less file both themes |
@magento run all tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please review and fix the failing static tests
I think new difference (Server Side Compilation) can acceptable as main archivement we want both workflow should visual same while compare with grunt or less frontend compilation. Some extend class not available in previously version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@engcom-Alfa, I checked the diff between the mainline and with a fix - seems like that was an issue that some styles were missing.
✔ approved from my side
✔️ QA Passed Case 1. Grunt compilationManual testing scenario:
Before: ✖️ some block-title rule styles are missing After: ✔️ All styles are applied Case 2. Server-side less compilationManual testing scenario:
After: ✔️ All styles are applied Case 3. Less frontend compilation (backend config)
After: ✔️ All styles are applied ✔️ No differences were found with the different compilation types
The styles have been checked on different pages with samples and everything is working properly. |
Hi @mrtuvn, thank you for your contribution! |
hey guys GeneralSelectors of referenced files of styles shouldn't be included to output css files. This fix brakes previous logic. EnvBuild: default deploying ( BeforeWhen we had the directive We had 194 matches of And 36 matches in styles-m.css had size: 53.2kb. AfterWhen this fix has been applied and the directive We have 323 matches of And 45 matches in styles-m.css have size: 53.9kb (was 53.2.kb) Explanation
With reference (before this commit)If I move I don't have any matches with the selector: Even I extend the selector for any selectors in any less file without the directive I don't have matches with the abs selector but I have applied styles via Without reference (after this commit)I write my own abs selector without using it: But this selector compiled to output css as simple selector of any less files: And when I extend it in any files: SummaryThe logic of creating helper selectors have been destroyed to use Most of production projects don't use Grunt as a tool of deploying styles. It has to work with the default deploying process of magento as expected. Please rollback changes. cc: @ihor-sviziev |
@mrtuvn could you please look at @Inevix comment? |
@ihor-sviziev @mrtuvn Points
ExampleSolutionAdd Imports of the file really might be removed from Change the code of Result |
@Inevix, if you already did research, could you please send a Pull Request with suggested changes? |
@ihor-sviziev done: |
Description (*)
Difference being that .abs- styles which extend other .abs- styles in _extends.less are not output properly when compiled with Grunt, due to being nested (e.g. .abs-action-addto-product, which extends .abs-action-link-button or .abs-account-blocks). This creates differences between production and development sites, which make some style issues invisible in a standard development workflow.
More details provide
E.g. customer account page
https://github.com/magento/magento2/blob/2.4-develop/app/design/frontend/Magento/blank/Magento_Customer/web/css/source/_module.less#L136
call .abs-account-blocks in module.less,
.abs-account-blocks defined in _extends.less call to .abs-account-title
https://github.com/magento/magento2/blob/2.4-develop/app/design/frontend/Magento/blank/web/css/source/_extends.less#L197
So the results output we will miss some styles. Reason see link below describe in less docs
From less doc describe
extending does not match selectors inside a nested @media declaration:
Reference => http://lesscss.org/features/#extend-feature (open in new tab)
Less official doc
Link http://lesscss.org/features/#import-atrules-feature (open new tab)
Before change tests
Less compile to css by php
Use grunt/lessc
Magento use grunt + grunt-contrib-less for compile
We lost some rules styles block-title
RESULTS:
After change
Both workflow output same results (php less compile vs grunt or client less compiler)
Before remove (reference)
styles-m.css 375,4 kB 14669LOC
styles-l.css 95,1 kB 3685LOC
After Remove (reference)
styles-m.css 375,4 kB 14669LOC
styles-l.css 95,1 kB 3685LOC
Related Pull Requests
Fixed Issues (if relevant)
Manual testing scenarios (*)
1.Create a custom theme that extends Magento/blank or Magento/luma
2.Create an _extend.less file in the custom theme
3.Add various styles to each group with the same selectors and specificity
4.Recompile CSS with either Grunt or server-side compilation
5.Confirm that all common styles in styles-m.css (including those from _extend.less) are output above all media queries
Scenario1 Server-side less compilation
Normal magento use by run commands
setup:upgrade && setup:static-content:deploy
https://devdocs.magento.com/guides/v2.4/frontend-dev-guide/css-guide/css_quick_guide_mode.html
Scenario2 Grunt compilation
https://devdocs.magento.com/guides/v2.4/frontend-dev-guide/css-topics/css_debug.html
Scenario 3 Less frontend compilation (backend config)
(Stores > Configuration > Advanced > Developer
Frontend Development Workflow => Workflow type : Client side less compilation)
Questions or comments
CC: @Leland @krzksz @ptylek
Contribution checklist (*)