-
Notifications
You must be signed in to change notification settings - Fork 45
Description
Less.js does not allow space between unary minus and a number behind it, less4j currently omits this requirement.
Input:
something {
margin: - -2;
margin: - 2 -2 -2 -2;
margin: -1 - 1;
parentheses: 12 - 23;
simple: - 23;
}
Less.js:
inExpression {
margin: - 1- 1- 1- 1;
margin: - 2 -2 -2 -2;
margin: -1 - - 1;
parentheses: (12) (- 23);
simple: - 23;
}
Less4j:
inExpression {
margin: -4;
margin: -2 -2 -2 -2;
margin: 0;
parentheses: 12 -23;
simple: -23;
}
Four important points:
1.) Less.js behaviour follows CSS specification which requires no space between the unary '-' and the number behind it:
- correct negative number:
-3
- incorrect negative number:
- 3
2.) When this situation happens, Less.js produces incorrect CSS while less4j produces correct one. Once we fix the difference, we should make less4j produce warning when this happend. It is likely that the author of .less file did not planned to produce incorrect .css.
3.) Handling of spaces in expressions is already subtle and thus may have confuse the user. Difference between less4j and less.js makes situation even more complicated and may be even more confusing - therefore it must be removed.
4.) Functions: the same applies for functions. This makes it impossible to combine unary '-' and a function.
Input:
inFunctions {
width: round(15);
width: - round(15);
width: -round(15);
}
Less.js output:
inFunctions {
width: 15;
width: - 15;
width: -round(15);
}