-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Difference in less compilation between php & nodejs library (grunt) with complicated calc
expressions
#37841
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
Comments
Hi @hostep. Thank you for your report.
Join Magento Community Engineering Slack and ask your questions in #github channel. |
calc
when using less php library compared to less compiling via gruntcalc
expressions
Unfortunately, not enough information was provided to create a Jira ticket. Please make sure you added the following label(s): Once all required labels are present, please add |
@magento give me 2.4-develop instance |
Hi @engcom-Dash. Thank you for your request. I'm working on Magento instance for you. |
Hi @engcom-Dash, here is your Magento Instance: https://919f190ef565a01a8683042e4344fc83.instances-prod.magento-community.engineering |
Hi @engcom-November. Thank you for working on this issue.
|
Hello @hostep, Thank you for the report and collaboration! We were able to reproduced the issue on 2.4-develop. We have followed your steps, and it can be seen that Thank you. |
❌ Something went wrong. Cannot create Jira issue. |
❌ Something went wrong. Cannot create Jira issue. |
✅ Jira issue https://jira.corp.adobe.com/browse/AC-9712 is successfully created for this GitHub issue. |
✅ Confirmed by @engcom-November. Thank you for verifying the issue. |
Hi @hostep, Internal team has started to work on it. Thanks. |
Hello, As I can see this issue got fixed in the scope of the internal Jira ticket AC-9712 by the internal team Based on the Jira ticket, the target version is 2.4.8-beta1. Thanks |
Uh oh!
There was an error while loading. Please reload this page.
Preconditions and environment
Other things to prepare here:
$ cp package.json.sample package.json $ cp Gruntfile.js.sample Gruntfile.js $ npm install $ bin/magento deploy:mode:set developer # so that when compiling less via php, it's not being minified, so that comparing files is easier
news_from_date
andnews_to_date
perform the following change:Steps to reproduce
$ diff -u /tmp/magento-scd-comparison/frontend/Magento/luma/en_US/css/styles-m.css pub/static/frontend/Magento/luma/en_US/css/styles-m.css | grep -C3 calc
Output:
Expected result
The
width: calc
expressions are the same between the PHP less library & nodejs less library:Actual result
The
width: calc
expressions are different between the PHP less library & nodejs less library:How it looks with less.js:
How it looks with less.php:
Additional information
You may be surprised by the screenshots, but reading the original less code (which contains a bug), it should be rendered like the less.js result (the bug can be fixed by changing
+ @indent__s
to- @indent__s
which makes a lot more sense)I've tried this again but with v4 of
wikimedia/less.php
(which is being used in Magento as php library to compile less, currently v3 is being installed). And v4 fixes this problem, I'm pretty much convinced this fixed it: wikimedia/less.php@5ca673dSo the solution for Magento is to switch from v3 to v4 of
wikimedia/less.php
. An additional benefit is that v4 is slightly faster than v3, about 1 second faster average when runningbin/magento setup:static-content:deploy
with all 3 default Magento themes.I'm currently working on a PR that will upgrade
wikimedia/less.php
to v4, but it's more complicated, some less code in Magento is not written correctly (especially around thosecalc
expressions) and we'll need to tweak it bit.Expect a PR soon (maybe today, maybe later this week)
Release note
No response
Triage and priority
The text was updated successfully, but these errors were encountered: