Command Line, Modify Var and the "=" Character
Nobody has claimed this yet.
- 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
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 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