No import(-once) happens, if file already imported to another scope
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 17k
- Forks
- 3.4k
- Avg merge
- 7h 42m
- Merged PRs (30d)
- 26
Description
When I use common import (without multiple), the file seems not to be imported if it was already imported into another scope.
This behavior is not obvious and produces unexpected errors. Is that a bug?
Reproduces in current version of LESS (2.7.2), and as well in upcoming 3.0.
A minimal fileset to reproduce:
variable.less
@some-variable: 'some-value';
main.less
@media all {
@import 'variable';
}
@import 'variable';
element {
content: @some-variable;
}
Expected CSS output:
element {
content: 'some-value';
}
Actual output (exception):
NameError: variable @some-variable is undefined in main.less on line 7, column 14:
6 element {
7 content: @some-variable;
8 }
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 minimal fileset from the issue: variable.less and main.less, using the reported LESS versions, and compare the generated CSS with the expected output. Trace how the two imports are resolved across the @media scope, then verify that the outer import makes @some-variable available without the reported exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css, javascript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100