-
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
Fixes less compilation problems in the Magento/blank theme #24001
Fixes less compilation problems in the Magento/blank theme #24001
Conversation
Hi @hostep. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
Hi @hostep,
I think it should affect styles of luma theme as it extends from blank. If so - looks like definitions should be moved to blank. |
Thanks for the feedback! For the But I'm having some doubts about the I'll try to do some more digging somewhere in the next few days myself, see how the other less code in Blank and Luma work exactly. |
… in the lib code while it was being defined in the Magento/backend theme.
…agento_AdvancedCheckout module. This should in theory improve the frontend layout rendering as to how it was intended.
…me so they can both use it.
…hey can both use it.
a26c803
to
937b2c0
Compare
@ihor-sviziev, I've amended my second commit and restored the removal of the usage of I've then rebased on the latest I've also edited the opening post with all this new information. Phew, a lot of work but I think most of it should be ok now! 🙂 |
Hi @ihor-sviziev, thank you for the review. |
Hi @hostep, thank you for your contribution! |
Description (*)
Hi
This PR is fixing less compilation problems in Magento's Blank theme as being reported in #23619
A PR for fixing similar problems in the Luma theme exists over here.
These less compilation problems can be found when using the original less.js compiler. Using version 2 or 3 of this compiler will output these problems.
These problems aren't being shown when using the php port of this compiler which Magento uses by default.
But the fact that these compilation errors are being reported means that certain less code in Magento isn't quite right.
And by digging in further, I was able to fix some problems which even improve the rendering on the frontend for features which were supposed to work, but didn't work due to these (hidden) errors.
This PR consists of 5 commits.
Commit 1
The first commit is not directly related to the Blank theme, but caused a compilation problem with the Blank theme nonetheless:
.abs-modal-overlay
is being defined in the backend theme, but used in thelib
code, so that's incorrect. Moved the usage to the backend theme. The resulting css files don't change by doing this.Commit 2
The second commit is simply cleanup of code causing most of the compilation problems:
.abs-no-display-desktop
was being used in a different media query then where it was defined, resulting in the compiler not being able to find it. By moving it in the correct media query, we fix the compilation problem..abs-clearfix
is being defined in the backend theme, but was being used in a frontend theme, so this never worked, removed its usage on the frontend in this case.After this second commit, the resulting CSS is almost unchanged, except for a single change which cuts down the filesize of the resulting css file a tiny bit while do keeping the css code the same in behavior.
This is the diff of the css files after the second commit:
Commit 3
The third commit should in theory improve the rendering of a certain component in Magento Commerce.
Unfortunately I don't have a copy over here at the moment of Magento Commerce to test this out.
So if somebody could test this out in the Magento_AdvancedCheckout module on the frontend to see how and what this fixes exactly, that would be great!
.lib-clearfix
to that.block-addbysku .block-content
selector in this module@abs-blocks-2columns
to that.block-addbysku .block-content .box
selector in this moduleAfter this fix it should actually apply these mixins, before this fix these probably weren't being applied.
The diff in the generated css file after the third commit is a little bit more involved:
Commit 4
The definition
.abs-rating-summary
only existed in the Luma theme, but was being used in the Blank theme, so that didn't work. This definition is now copied over to the Blank theme so it can work again. This results in the stars of accepted product ratings to be vertically aligned.Also changed the comment above the definition in the Luma theme, as it was incorrectly copy/pasted from the block above.
The diff in the generated css after the fourth commit is:
Commit 5
The definition
.abs-account-title
only existed in the Luma theme, but was being used in the Blank theme, so that didn't work. This definition is now copied over to the Blank theme so it can work again. This results in the titles on certain pages to be styled slightly differently (bigger font-size, more margin-bottom), modules affected:Magento_GiftRegistry
,Magento_MultipleWishlist
&Magento_Multishipping
After copying, I've changed the variable in the definition for the border color from
@account-title-border-color
to@border-color__base
as the former doesn't exist in the Blank theme.The diff in the generated css after the fifth commit is:
Fixed Issues (if relevant)
Manual testing scenarios (*)
npm install less@3.9.0
rm -R var/view_preprocessed/* pub/static/*
bin/magento dev:source-theme:deploy --theme=Magento/blank --locale=en_US
styles-m.less
file using the less.js compiler:node_modules/.bin/lessc -l var/view_preprocessed/pub/static/frontend/Magento/blank/en_US/css/styles-m.less
Also do a full
rm -R var/view_preprocessed/* pub/static/*; bin/magento setup:static-content:deploy -f --theme=Magento/blank --theme=Magento/luma --theme=Magento/backend en_US
and compare the changes between the resulting css files without and with these fixes, only changed css files should be in the Blank theme, no other theme's css files should have changedThen look if these changes didn't cause regressions on the frontend when the Blank theme is being used
You can check in the frontend if the selector
.opc-estimated-wrapper
is still being hidden when the screens width >= 768px after this change on the checkout page:Somebody with access to Magento Commerce, should look at what happens to the following selectors and see if these are now being rendered properly (before the fix there should be something wrong with the layout I'm assuming):
.column .block-addbysku .block-content .box
.column .block-addbysku .block-content .box:nth-child(odd)
.column .block-addbysku .block-content .box:nth-child(even)
.column .block-addbysku .block-content:before
.column .block-addbysku .block-content:after
Have some accepted product review with ratings and see if the stars are vertically aligned:
Certain titles in the modules
Magento_GiftRegistry
,Magento_MultipleWishlist
&Magento_Multishipping
should be styled a bit differently, the font-size should be2.2rem
instead of1.8rem
and the margin-bottom increases from15px
to25px
.I could only test this with the
Magento_Multishipping
module, the other two are part of Magento Commerce of which I don't have an installation running here. So those should be checked as well I assume?Before:
After:
Questions or comments
It would be nice if Magento could get some automated test which uses the less.js compiler linting mode to detect these problems.
Since one of these compilation problems was recently introduced in the Luma theme code, it probably can't hurt to do some automated testing to prevent this from happening again in the future.
See Manual testing scenario above for the commands needed to detect this.
Contribution checklist (*)