Basic Less types for plugin authors (Quick Reference Card)
Open
Nobody has claimed this yet.
api documentation
- Dominant language
- Less
- Stars
- 680
- Forks
- 442
- PR merge metrics
- No merged PRs in 30d
Description
Posting this WIP here (per discussion at https://github.com/less/less.js/commit/809dc509f33652d8bcef9545dbade37bc4aef02a)
| 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:
Quotedconstructor 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 laterevalcode involving onlycontent/valuevalue).- Or any other value. Basically, in
whenguards (so far they are the only statement where boolean values do matter) anything butKeyword('true')counts asfalse.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the proposed Quick Reference Card and the linked discussion commit, then compare its type names and examples with the Less tree link and the two notes. Confirm the intended documentation location and resolve the noted Quoted and boolean behavior before publishing the agreed reference card.
Written by the indexing model from the issue text.
Assessment
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100