{"data":{"id":"magento2-37842","source":"github-pr","sourceRef":"magento/magento2#37842","title":"Difference in less compilation between php & nodejs library (grunt) with complicated `calc` expressions","pr":{"number":37842,"url":"https://github.com/magento/magento2/pull/37842","author":"hostep","mergedAt":"2024-09-12T01:23:44Z","mergeCommit":"d28c2a8a081425f74c780d4f19468830daf86ecc","headCommit":"14c00b30ea20fb3871f9e312893d1a0b7b9db080","baseRef":"2.4-develop","diffSha256":"b7ffa5295996f06347bb87dd01611275249855ca1923a2f58ffe171ded99583c"},"issues":[{"number":37841,"url":"https://github.com/magento/magento2/issues/37841","title":"Difference in less compilation between php & nodejs library (grunt) with complicated `calc` expressions","labels":["Area: Framework","Component: Frontend","Issue: Confirmed","Priority: P2","Progress: done","Reported on 2.4.x","Reproduced on 2.4.x","Triage: Dev.Experience"],"kind":"human"}],"fixedIn":"2.4.8","containingTags":["2.4.8","2.4.8-p1","2.4.8-p2","2.4.8-p3","2.4.8-p4","2.4.8-p5","2.4.9"],"reportedOn":null,"codeMatch":{"2.4.6":"conflict","2.4.6-p1":"conflict","2.4.6-p2":"conflict","2.4.6-p3":"conflict","2.4.6-p4":"conflict","2.4.6-p5":"conflict","2.4.6-p6":"conflict","2.4.6-p7":"conflict","2.4.6-p8":"conflict","2.4.6-p9":"conflict","2.4.6-p10":"conflict","2.4.6-p11":"conflict","2.4.6-p12":"conflict","2.4.6-p13":"conflict","2.4.6-p14":"conflict","2.4.6-p15":"conflict","2.4.7":"clean","2.4.7-p1":"clean","2.4.7-p2":"clean","2.4.7-p3":"clean","2.4.7-p4":"clean","2.4.7-p5":"clean","2.4.7-p6":"clean","2.4.7-p7":"clean","2.4.7-p8":"clean","2.4.7-p9":"clean","2.4.7-p10":"clean","2.4.8":"conflict","2.4.8-p1":"conflict","2.4.8-p2":"conflict","2.4.8-p3":"conflict","2.4.8-p4":"conflict","2.4.8-p5":"conflict","2.4.9":"conflict"},"affectedVersions":["2.4.7","2.4.7-p1","2.4.7-p2","2.4.7-p3","2.4.7-p4","2.4.7-p5","2.4.7-p6","2.4.7-p7","2.4.7-p8","2.4.7-p9","2.4.7-p10"],"components":["magento/framework","magento/magento2-base"],"files":[{"path":"app/design/frontend/Magento/blank/web/css/source/_extends.less","change":"modified","package":"magento/magento2-base"},{"path":"app/design/frontend/Magento/luma/web/css/source/_extends.less","change":"modified","package":"magento/magento2-base"},{"path":"lib/internal/Magento/Framework/composer.json","change":"modified","package":"magento/framework"}],"stripped":{"tests":[],"docs":[],"outsideCode":["composer.json","composer.lock"]},"linesChanged":10,"mergeBatched":false,"excluded":null,"sections":{"description":"The `width: calc` expressions are different between the PHP less library & nodejs less library:","stepsToReproduce":"1. First run the less compilation through the less library in php:\n```shell\n$ rm -R var/view_preprocessed/* pub/static/*\n$ bin/magento setup:upgrade # needed to be able to visit frontend without js errors\n$ bin/magento setup:static-content:deploy -f en_US\n```\n2. Now copy the resulting files in some other directory:\n```shell\n$ cp -r pub/static/ /tmp/magento-scd-comparison\n```\n3. In one tab in your browser,  visit the frontend of the shop and click on Advanced Search in the footer and keep this open\n4. Now run the less compilation through grunt (so via nodejs instead of php):\n```shell\n$ rm -R var/view_preprocessed/* pub/static/*\n$ bin/magento setup:upgrade # needed to be able to visit frontend without js errors\n$ grunt clean:luma && grunt exec:luma && grunt less:luma\n```\n5. Now compare the resulting files with the ones you copied before, I'm focusing here on something very specific (not all changes are relevant or important here):\n```shell\n$ 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\n```\nOutput:\n```diff\n-.form.search.advanced .fields.range .field.date input,\n-.form-giftregistry-edit .field.date input {\n-  margin-right: 10px;\n-  width: calc(100% - 33px);\n+.form-giftregistry-search .fields-specific-options .datetime-picker {\n+  margin-right: 10px;width: calc(100% - 23px + 10px);\n }\n .field .control._with-tooltip {\n   position: relative;\n }\n .field .control._with-tooltip input {\n-  margin-right: 10px;\n-  width: calc(100% - 36px);\n+  margin-right: 10px;width: calc(100% - 21px + 10px + 5px);\n }\n .checkout-index-index .modal-popup .field-tooltip .field-tooltip-content,\n .shipping-policy-block.field-tooltip .field-tooltip-content {\n```\n6. In a second tab in your browser, visit the frontend of the shop and click on Advanced Search in the footer and compare it to your first tab","expectedResult":"The `width: calc` expressions are the same between the PHP less library & nodejs less library:\n\n```\nless.js:\n1. width: calc(100% - 23px + 10px);\n2. width: calc(100% - 21px + 10px + 5px);\n\nless.php:\n1. width: calc(100% - 23px + 10px); or width: calc(100% - 13px);\n2. width: calc(100% - 21px + 10px + 5px); or width: calc(100% - 6px);\n```","actualResult":"The `width: calc` expressions are different between the PHP less library & nodejs less library:\n\n```\nless.js:\n1. width: calc(100% - 23px + 10px);   => simplified: width: calc(100% - 13px);\n2. width: calc(100% - 21px + 10px + 5px); => simplified: width: calc(100% - 6px);\n\nless.php:\n1. width: calc(100% - 33px);\n2. width: calc(100% - 36px);\n```\n\nHow it looks with less.js:\n\n<img width=\"702\" alt=\"Screenshot 2023-08-03 at 17 41 03\" src=\"https://github.com/magento/magento2/assets/85479/0db0f2d2-8efc-4898-8552-88d6c9047b71\">\n\nHow it looks with less.php:\n\n<img width=\"715\" alt=\"Screenshot 2023-08-03 at 17 38 36\" src=\"https://github.com/magento/magento2/assets/85479/c8cb60e9-315d-4689-81e1-ac6ea1f09628\">","source":"issue"},"signatures":[],"labels":{"area":["Framework"],"component":["Frontend"],"priority":"P2","severity":null,"reportedOn":["2.4.x"]},"categories":[],"triage":{"model":"@cf/cloudflare/clef","requestHash":"37d5b4717552a6c50d74dea2680de6b068f6bb49af4c3b4d5e494923af8f06e1","isBugfix":0.893,"changeKind":{"choice":"bugfix","probabilities":{"bugfix":0.5975,"feature":0.0057,"refactor":0.0099,"tests_only":0.0035,"docs_only":0.003,"dependency":0.3333,"cleanup":0.0471},"confidence":0.3822},"scope":{"score":0.8832,"probabilities":{"0":0.2187,"1":0.6794,"2":0.1019},"confidence":0.2797},"risk":{"score":0.8069,"probabilities":{"0":0.2506,"1":0.6919,"2":0.0575},"confidence":0.3173},"area":{"choice":"frontend","probabilities":{"catalog":0.0124,"checkout":0.0067,"customer":0.0051,"admin":0.0253,"graphql_api":0.0033,"framework":0.1317,"frontend":0.795,"other":0.0205},"confidence":0.6008},"securityRelevant":0.0061,"reportedVersion":{"choice":"unspecified","probabilities":{"2.4.0":0.0083,"2.4.0-p1":0.0061,"2.4.1":0.0051,"2.4.1-p1":0.0043,"2.4.2":0.0064,"2.4.2-p1":0.0049,"2.4.2-p2":0.0067,"2.4.3":0.0125,"2.4.3-p1":0.0114,"2.4.3-p2":0.0122,"2.4.3-p3":0.0079,"2.4.4":0.0123,"2.4.4-p1":0.0103,"2.4.4-p10":0.0078,"2.4.4-p11":0.0089,"2.4.4-p12":0.0088,"2.4.4-p13":0.0089,"2.4.4-p14":0.0097,"2.4.4-p15":0.007,"2.4.4-p16":0.0074,"2.4.4-p17":0.0068,"2.4.4-p18":0.0063,"2.4.4-p2":0.0037,"2.4.4-p3":0.0041,"2.4.4-p4":0.0044,"2.4.4-p5":0.0054,"2.4.4-p6":0.005,"2.4.4-p7":0.006,"2.4.4-p8":0.0059,"2.4.4-p9":0.0048,"2.4.5":0.0111,"2.4.5-p1":0.0102,"2.4.5-p10":0.0084,"2.4.5-p11":0.0113,"2.4.5-p12":0.0088,"2.4.5-p13":0.0088,"2.4.5-p14":0.0107,"2.4.5-p15":0.0069,"2.4.5-p16":0.0069,"2.4.5-p17":0.0079,"2.4.5-p2":0.0046,"2.4.5-p3":0.0065,"2.4.5-p4":0.008,"2.4.5-p5":0.0061,"2.4.5-p6":0.0065,"2.4.5-p7":0.0073,"2.4.5-p8":0.0067,"2.4.5-p9":0.0053,"2.4.6":0.0156,"2.4.6-p1":0.0134,"2.4.6-p10":0.009,"2.4.6-p11":0.0105,"2.4.6-p12":0.01,"2.4.6-p13":0.0106,"2.4.6-p14":0.0086,"2.4.6-p15":0.0074,"2.4.6-p2":0.0054,"2.4.6-p3":0.0073,"2.4.6-p4":0.0094,"2.4.6-p5":0.0093,"2.4.6-p6":0.0077,"2.4.6-p7":0.0078,"2.4.6-p8":0.0066,"2.4.6-p9":0.0059,"2.4.7":0.013,"2.4.7-p1":0.0114,"2.4.7-p10":0.0099,"2.4.7-p2":0.0064,"2.4.7-p3":0.0112,"2.4.7-p4":0.0125,"2.4.7-p5":0.0095,"2.4.7-p6":0.0108,"2.4.7-p7":0.0081,"2.4.7-p8":0.0071,"2.4.7-p9":0.0055,"2.4.8":0.0118,"2.4.8-p1":0.0125,"2.4.8-p2":0.0126,"2.4.8-p3":0.0127,"2.4.8-p4":0.0117,"2.4.8-p5":0.0109,"2.4.9":0.0129,"unspecified":0.3037},"confidence":0.0877},"backportWorthy":{"score":0.9194,"probabilities":{"0":0.3581,"1":0.3644,"2":0.2775},"confidence":0.007}},"curated":{"title":"Width calc expressions are different between the PHP and nodejs less library","description":"In the blank and luma _extends.less, the date input and checkout tooltip input width calc adds @indent__s, and the PHP less library gives calc(100% - 33px) where less.js has calc(100% - 23px + 10px). The change uses - @indent__s and - @indent__xs in both themes and sets wikimedia/less.php to ^3.2 || ^5.0 in the Framework composer.json.","categories":[],"author":"claude-code/opus-5.5","date":"2026-10-06","reviewedBy":null},"tests":null},"_documentation":"https://magento.watch/api","_description":"Upstream fix magento2-37842 details"}