Guarded namespace unavailable when calling mixin with ruleset
Open
Nobody has claimed this yet.
bug
needs decision
- Dominant language
- JavaScript
- Stars
- 17k
- Forks
- 3.4k
- Avg merge
- 7h 42m
- Merged PRs (30d)
- 26
Description
I keep running into issues today it seems.
Example:
#media {
#desktop (@ruleset) {
@media (min-width: 700px) {
@ruleset();
}
}
#mobile (@ruleset) {
@media (max-width: 699px) {
@ruleset();
}
}
}
@switch: demo;
.example {
#lookup when (@switch = demo) {
@not-found: 1;
}
@found: 2;
#lookup2 {
@also-found: 3;
}
#media#desktop({
// Comment the next line and it will all compile
error: #lookup[@not-found];
success1: @found;
success2: #lookup2[@also-found];
});
}
Expected output:
@media (min-width: 700px) {
.example {
error: 1;
success1: 2;
success2: 3;
}
}
Actual output: variable @not-found not found .
I managed to narrow it down to usage of the guard. Remove it and it works. Put the namespace within the ruleset and it works.
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
Reproduce the supplied Less example and confirm that the guarded namespace call fails while the unguarded variant succeeds. Trace the compiler path for guarded namespace lookup and add a regression test covering the expected CSS output; done when @not-found resolves to 1 without breaking the other properties.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100