Global Variables with a literal "." in the value causes the variable to be undefined
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 17k
- Forks
- 3.4k
- Avg merge
- 7h 42m
- Merged PRs (30d)
- 26
Description
To reproduce:
This can be reproduced using the CLI or the programmatic API. Assuming that LESS is already installed, it is most straightforward to reproduce using the CLI:
echo "body { color: @buildVersion; }" | npx lessc --global-var="buildVersion=a.hello" -
On the other hand, removing the literal period allows this to work:
echo "body { color: @buildVersion; }" | npx lessc --global-var="buildVersion=hello" -
LESS Code:
body { color: @buildVersion; }
Current behavior:
The LESS compiler throws an error that the global variable is undefined.
Expected behavior:
The LESS compiler should not throw an error and the global variable should be defined.
Environment information:
lessversion: 3.5.0 - 4.1.3 (current)nodejsversion: 16.13.2operating system: Windows
Appears to have been introduced in 3.5.0. Version 3.0.4 appears to be working fine.
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 running the provided npx lessc command with and without the literal period, then compare how the --global-var value is handled through the CLI and programmatic API. Look for the global-variable parsing or resolution path and add a regression check; done means the a.hello value compiles without an undefined-variable error while the existing hello case still works.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli, compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100