Closed lefevre00 closed 2 years ago
So, there's a very old comment from @cloudhead, the creator of Less, in an issue thread that I wish I had bookmarked somewhere. Which is to say that Less is not necessarily intended to be a 100% super-set of CSS, but is more a super-set of good CSS, or basically standards-based CSS.
You can have !IMPORTANT
as a token or !ImPoRtAnT
as a token in CSS (previous versions of CSS actually allowed ! I M P O R T A N T
IIRC), but you will find no CSS guide that tells you to write this in any other way than !important
. So there's what the CSS spec allows, yes, but unless there's a use case for why someone should put this in their style document. There are a lot of cases where Less narrows what's allowed further than the CSS spec, based on what is commonly uses in 99% of style documents.
So IMO there's no reason to do this unless there's some reason why someone cannot / will not write !important
which is more recognizable to every other style author.
Just as an anecdote, this is also a valid (or, rather, error-recoverable) CSS file according to the spec:
.box {
color: linear-gradient(45deg, blue, red
However, Less requires you to have well-formed parentheses / blocks etc
This bug is based on the RFC : https://www.w3.org/TR/css-syntax-3/#consume-declaration :
To reproduce:
Current behavior: The compilation fails with the error:
ParseError: Unrecognised input on line 2
Expected behavior: The generated css should include the uppercased string
!IMPORTANT
.Environment information:
Reproduce in the browser and in terminal with node.
less
version: 4.1.3nodejs
version: v16.15.1operating system
: mac os 12.4