less / less.js

Less. The dynamic stylesheet language.
http://lesscss.org
Apache License 2.0
17k stars 3.41k forks source link

Round with divide is failing to build #3634

Closed Congelli501 closed 3 years ago

Congelli501 commented 3 years ago

Compiling this less source is not working with less 4.1.1:

div {
    width: round(1 / 2);
}

Result:

ArgumentError: Error evaluating function `round`: argument must be a number in test.less on line 2, column 9:
1 div {
2   width: round(1 / 2);
3 }

Same result with 4.0.0, but working ok with lessc 3.13.1

Expected (as with less 3.13.1):

div {
  width: 1;
}
iChenLei commented 3 years ago

Less and Sass do same respect for / (divide) but with different solution.

Sass change: https://sass-lang.com/documentation/breaking-changes/slash-div Less change: https://lesscss.org/usage/#less-options-math


After less v4, you must write code like follow:

div {
  width: round((1 / 2));
}