Skip to content

Conversation

@Krinkle
Copy link
Contributor

@Krinkle Krinkle commented Jun 9, 2025

In Less.js 1.x-3.x the default was strictMath:false, which means math is eagerly evaluated, instead of only "strictly" between parenthesis.

This has the downside of interpreting "/" slashes in newer CSS syntax as Less division, instead of as separator between values in those CSS features (aspect-ratio, border-radius, font).

As such, Less.js 4.x, and Less.php 5.x, renamed "strictMath" to "math", with a new third option "parens-division" as the default, alongside "always" (aka strictMath:false) and "parens" (aka strictMath:true). This option means math is still eagerly evaluated in most cases (plus, minus, multiply, etc) but no longer for division. I don't know if or when the Winter ecosystem wants to adopt this new default, but for now, to minimise disruption and unblock the Less.php upgrade, I suggest simply setting strictMath: false explicitly so that when someone installs Less.php 5.x, they get the same behavior as before.

This decouples the trivial Less.php upgrade from the (potentially non-trivial, or unwanted) math migration.

Ref https://phabricator.wikimedia.org/T366445.
Ref https://github.com/wikimedia/less.php/blob/master/CHANGES.md.

See also:

Krinkle added 2 commits June 9, 2025 10:00
In Less.js 1.x-3.x the default was strictMath:false, which means
math is eagerly evaluated, instead of only "strictly" between
parenthesis.

This has the downside of interpreting "/" slashes in newer CSS
syntax as Less division, instead of as separator between
values in those CSS features (aspect-ratio, border-radius, font).

As such, Less.js 4.x, and Less.php 5.x, renamed "strictMath"
to "math", with a new third option "parens-division" as the 
default, alongside "always" (aka strictMath:false) and "parens"
(aka strictMath:true). This option means math is still eagerly
evaluated in most cases (plus, minus, multiply, etc) but no
longer for division. I don't know if or when the Winter
ecosystem wants to adopt this new default, but for now, to
minimise disruption and unblock the Less.php upgrade,
I suggest simply setting `strictMath: false` explicitly so that
when someone installs Less.php 5.x, they get the same
behavior as before.

This decouples the trivial Less.php upgrade from the
(potentially non-trivial, or unwanted) math migration.

Ref https://phabricator.wikimedia.org/T366445.
Ref https://github.com/wikimedia/less.php/blob/master/CHANGES.md.
I considered setting it to `^3.0 || ^5.0` but, given that this repo
requires `PHP >= 8.1` that would be identical to `^5.0` since
Less.php 5.0 started to require PHP 8.1, so there are no PHP
versions where Composer would look for an older version.

Ref assetic-php/assetic#38.
@LukeTowers LukeTowers added this to the 1.2.8 milestone Jun 9, 2025
@LukeTowers LukeTowers requested a review from bennothommo June 9, 2025 20:56
Copy link
Member

@bennothommo bennothommo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks a lot @Krinkle!

@LukeTowers LukeTowers merged commit 2bee5c2 into wintercms:develop Jun 11, 2025
10 checks passed
@Krinkle Krinkle deleted the patch-1 branch June 12, 2025 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants