less / less/less.js

Detached ruleset unlocked from namespaced mixin does not see its namespace scope

Open
#2,038 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I defined a detached ruleset inside a namespaced mixin. The ruleset is unable to see variables defined in its outer namespace.

Less:

#namespace {
  @variable: in-namespace;
  .unlocker {
    @detached-ruleset: { property: @variable; };
  }
}
#namespace > .unlocker();

#detached-ruleset {
  @detached-ruleset();
}

actual output:

NameError: variable @variable is undefined in test.less on line 4, column 36:
3   .unlocker {
4     @detached-ruleset: { property: @variable; };
5   }

expected output:

#detached-ruleset {
  property: in-namespace;
}

Edit: I use node.js with lessc 1.7.0 (LESS Compiler) [JavaScript]
Edit 2: this issue is probably related to #2039

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 by running the minimal Less example with lessc, using the namespaced mixin and detached ruleset shown in the report. Trace how the detached ruleset is unlocked and resolve its namespace scope; done means the output contains property: in-namespace instead of the undefined-variable error.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, javascript, node.js
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.