Skip to content

Detached ruleset scopes affected — Recording an error reporting #2868

Open

Description

@golegen

When I refer to the code in the manual for testing, I found the detached ruleset scopes affected.
( use webstorm and less 2.6.1)
View code,Please visit Less manual

Reads as follows

Variable and mixins accessible form definition win over those available in the caller:

@variable: global;
@detached-ruleset: {
    // will use global variable, because it is accessible
    // from detached-ruleset definition
    variable: @variable; 
};
selector {
    @detached-ruleset();
    @variable: value; // variable defined in caller - will be ignored
}

compiles into:

selector {
    variable: global;
}

If you add additional code in front of manual reference code,for example:

//additional code
@testvalue: 2px;
#test {
    width: @testvalue;
}

//manual reference code
@variable: global;
@detached-ruleset: {
    // will use global variable, because it is accessible
    // from detached-ruleset definition
    variable: @variable; 
};
selector {
    @detached-ruleset();
    @variable: value; // variable defined in caller - will be ignored
}

compiles into:

#test {
    width: 2px;
}
selector {
    variable: value;
}

The value of variable: global becomes value;
At present, I can not explain why.
I can only record as an error reporting.

Activity

  1. changed the title [-]Detached ruleset scopes affected —— Recording an error report[/-] [+]Detached ruleset scopes affected — Recording an error reporting[/+] on Apr 12, 2016
  2. ShirayukiRin commented on Aug 10, 2026

    @ShirayukiRin

    Hi,
    Although this issue was opened about 10 years ago, I can still reproduce this on the latest master branch with the example you provided.
    I would like to work on a fix for this.

  3. added a commit that references this issue on Nov 9, 2026
    7b7c4e5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions