less / less/less.js

difference between a imported namespace and a declared one

Open
#1,895 14 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

this code work well:

#ns {
.nsmixin(@color){
color: @color;
}
}

.mixin()
{
.test2 {
        #ns > .nsmixin(blue);
}
}
.mixin();

Then i create a file ns.less which contains:

.nsmixin(@color){
color: @color;
}

now the code below shows an error:

#ns { @import "ns.less";}

.mixin()
{
.test2 {
        #ns > .nsmixin(blue);
}
}
.mixin()

error: "SyntaxError: #ns > .nsmixin is undefined" this only happens when its wrapped inside a mixin. Use the namespace in a class works well too:

   #ns { @import "ns.less";}
   .test2 {
        #ns > .nsmixin(blue);
    }

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

Reproduce the two namespace examples and compare declared versus imported namespaces, especially when the namespace is referenced inside a mixin. The payload names no source files or tests, so first locate the namespace and import-resolution code and any existing regression tests. Done means the behavior is fixed consistently or the supported difference is clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.