less / less/less.js

Can't extend a nested class (concatenated selector)

Open
#1,597 21 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Heya guys.

I have found an annoying issue, which is pretty basic use of two mechanics:
I cant extend a class i generate by nesting it using "& {}"

Heres my example:

.box {
    padding: @base-spacing;

    &--large {
        padding: @large-spacing;
    }
}

.foo {
    &:extend(.box--large);
}

Expected result:

.box {
    padding: 24px;
}

.box--large,
.foo {
        padding: 48px;
}

What actually happens:

.box {
    padding: 24px;
}

.box--large {
    padding: 48px;
}

Imo this is very basic use of two mechanics, and it's not like its generated by some kind of wizard looping mixin.
Looking forward to have this fixed :-)

Kind regards, Dennis

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 nested selector and extend example from the issue in the Less compiler, then compare the generated CSS with the expected output. Trace the selector-extension entry point that handles the concatenated .box--large selector. Done means the output includes .foo alongside .box--large for the nested class.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.