parcel-bundler / parcel-bundler/lightningcss

`@layer`s nested inside style rules are not merged

Open
#655 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
7.7k
Forks
302
PR merge metrics
No merged PRs in 30d

Description

When nesting an @layer inside a style rule it's properly lifted but multiple layers with the same name are not merged — whether minified or not. This merging typically happens even when not minifying but I think it would be acceptable if, to fix it, minification was required:

Playground Link

Input:

.foo {
  @layer utilities {
    color: red;
  }
}

.baz {
  @layer components {
    color: red;
  }
}

.bar {
  @layer utilities {
    color: red;
  }
}

Expected:

@layer utilities {
  .foo, .bar {
    color: red;
  }
}

@layer components {
  .baz {
    color: red;
  }
}

Actual:

@layer utilities {
  .foo {
    color: red;
  }
}

@layer components {
  .baz {
    color: red;
  }
}

@layer utilities {
  .bar {
    color: red;
  }
}

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 behavior using the linked Playground or the CSS input in the issue, comparing minified and non-minified output. Trace the nested @layer lifting and merging path, then verify that repeated utilities layers are combined while the components layer remains separate and the expected output is produced.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.