Open
Description
Posting this WIP here (per discussion at less/less.js@809dc50)
Trivial type | Less tree type | Less value example | Corresponding plugin code (less.tree prefix omitted) |
---|---|---|---|
number | Dimension | 12.34 |
new Dimension(12.34) |
42px |
new Dimension(42, 'px') |
||
identifier | Keyword | left |
new Keyword('left') |
background-color |
new Keyword('background-color') |
||
string | Quoted | "Hello, World!" |
new Quoted('', '"Hello, World!"') see [1] |
'Hello, World!' |
new Quoted('', "'Hello, World!'") see [1] |
||
boolean | Keyword | true |
new Keyword('true') |
false |
new Keyword('false') see [2] |
||
color | Color | #369 |
new Color('369') |
rgba(11, 22, 33, 0.5) |
new Color([11, 22, 33], .5) |
||
red |
Color.fromKeyword('red') |
||
comma list | Value | foo, 42 |
new Value([new Keyword('foo'), new Dimension(42)]) |
space list | Expression | foo 42 |
new Expression([new Keyword('foo'), new Dimension(42)]) |
arbitrary text | Anonymous | ~'foo$bar .baz' |
new Anonymous('foo$bar .baz') |
e('#$@&%*!') |
new Anonymous('#$@&%*!') |
Notes:
Quoted
constructor is definitely broken, it does not do what you expect by looking at its code (the first parameter is in fact never used most likely because of latereval
code involving onlycontent/value
value).- Or any other value. Basically, in
when
guards (so far they are the only statement where boolean values do matter) anything butKeyword('true')
counts asfalse
.