Skip to content

Mixin in a namespace sometimes errors when referring to nested sibling mixin. #1410

Closed
@Jimbly

Description

@Jimbly

This less code generates an error about ".sub is undefined":

.someclass { #namespace > .mixin(#F00); }
#namespace {
  .sub(@arg1) { background-color: @arg1; }
  .mixin(@color1) { .sub(@color1); }
}

But, none of the following do, which seems inconsistent. If the namespace is first, there is no error:

#namespace {
  .sub(@arg1) { background-color: @arg1; }
  .mixin(@color1) { .sub(@color1); }
}
.someclass { #namespace > .mixin(#F00); }

Or if the the error-generating mixin is moved out a scope level higher (but still later in the file):

.someclass { #namespace > .mixin(#F00); }
#namespace {
  .mixin(@color1) { .sub(@color1); }
}
.sub(@arg1) { background-color: @arg1; }

Or if it is referenced more explicitly:

.someclass { #namespace > .mixin(#F00); }
#namespace {
  .sub(@arg1) { background-color: @arg1; }
  .mixin(@color1) { #namespace > .sub(@color1); }
}

I could not find any reference in the documentation about whether or not order was required for mixins to work, though empirically it seems fine to reference a mixin defined after you reference it. It just seems to fail in this one case where referencing a mixin in a namespace which is referencing another mixin in the same namespace and all of this is after the first reference.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions