less / less/less.js

Parallel extends do not inherit styles

Open
#1,952 5 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

TL;DR: .B is nested inside .A. If .A1 extends .A and .B1 extends .B, I would expect that .A1 .B1 {} would inherit the same styles as .A .B {}. However it does not.

Demo here.

/*-----------*\
  less input:
\*-----------*/
.title {
    .firstpara {
        margin-top: 0;
    }
}
.title-main {
    &:extend(.title all);
}
.firstpara-main {
    &:extend(.firstpara all);
}


/*----------------*\
  returned result:
\*----------------*/
.title .firstpara,
.title-main .firstpara,
.title .firstpara-main {
    margin-top: 0;
}


/*----------------*\
  expected result:
\*----------------*/
.title .firstpara,
.title-main .firstpara,
.title .firstpara-main,
.title-main .firstpara-main {
    margin-top: 0;
}

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 with the linked CodePen reproduction and compare the generated selectors with the expected output in the issue. Trace the handling of parallel nested extends, then verify that the combined .title-main .firstpara-main selector is generated without regressing the existing selectors.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.