less / less/less.js

Command Line, Modify Var and the "=" Character

Open
#3,388 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

https://github.com/less/less.js/blob/2d43c0b9648daee7f226f1be9952654c80dea033/bin/lessc#L73-L76

To me, the above lines optimistically consider that no string variables containing an "=" char will ever be passed.
Considering the scenario where:

  • in a less file, I define a selector variable:
@shell_selector: "html";
@shell: (~"@{shell_selector}");

@{shell}{
    /* ... */
}
  • and in a command line:
lessc --modify-var="shell_selector='html[theme=dark]'" src/less/styles.less dist/css/styles-dark.css

The latter fails. The error message includes the line that cannot be interpreted by the parser:
@shell_selector: 'html[theme;
which is the result of the referenced lines of code on top.

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 at bin/lessc lines 73-76 and reproduce the issue with the provided --modify-var command and Less input. Trace how the command-line value is split, then verify that the selector value containing "=" reaches the parser intact without the shown error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.