less / less/less.js

Less fails to parse values from web platform tests:

Open
#3,396 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

low priority
Dominant language
JavaScript
Stars
17k
Forks
3.4k
Avg merge
7h 42m
Merged PRs (30d)
26

Description

According to: https://github.com/web-platform-tests/wpt/blob/master/css/css-variables/test_variable_legal_values.html

...Less should be able to parse a block like this for custom properties:

legal css variable values {
  --percentage: 25%;
  --number: 37;
  --length: 12em;
  --time: 75ms;
  --function: foo();
  --nested-function: foo(bar());
  --parentheses: ( );
  --braces: { };
  --brackets: [ ];
  --at-keyword-unknown: @foobar;
  --at-keyword-known: @media;
  --at-keyword-unknown-block: @foobar {};
  --at-keyword-known-block: @media {};
  --cdo-at-top-level: <!--;
  --cdc-at-top-level: -->;
  --semicolon-not-top-level: (;);
  --cdo-not-top-level: (<!--);
  --cdc-not-top-level: (-->);
}

However, as expected, Less fails with the at-keywords in custom properties (variable @foobar is undefined). Since custom property parsing is already permissive with logic for failing over (accepting almost anything until a closing outer semi-colon), it makes sense to allow "variable-like" values in custom properties to pass-through.

Thoughts?

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 with the web-platform-tests reference, css/css-variables/test_variable_legal_values.html, and compare its custom-property cases with Less's parsing behavior. Trace the custom-property handling for at-keyword values and verify that the block parses without an undefined-variable error while preserving the listed values.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, javascript
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.