less / less/less-docs

Basic Less types for plugin authors (Quick Reference Card)

Open
#446 7 comments 2 reactions 0 assignees View on GitHub

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:
  1. 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 later eval code involving only content/value value).
  2. Or any other value. Basically, in when guards (so far they are the only statement where boolean values do matter) anything but Keyword('true') counts as false.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.