less / less/less.js

Extend within container query

Open
#4,540 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
17k
Forks
3.4k
Avg merge
7h 42m
Merged PRs (30d)
26

Description

Extend seems to fail to take into account it being used within a container query.

To reproduce:

less-preview

.a {
  color: red;
}

@container container-name {
  .b {
    &:extend(.a);
  }
}

Current behavior:

Compiles down to this

.a,
.b {
  color: red;
}
@container container-name {
}

Expected behavior:

.a {
  color: red;
}

@container container-name {
  .b {
    color: red;
  }
}

Environment information:

  • less version: 4.9.1

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 less-preview reproduction using the @container and &:extend(.a) example. Trace how the compiler handles extend across the container query and compare the result with the expected CSS; done means .b receives .a's declarations inside the @container block without producing an empty block.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.