weback/css postcss-merge-rules extracts line-height into a merged rule, but css shorthand in the original rule resets it
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 142k
- Forks
- 32.5k
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 351
Description
Link to the code that reproduces this issue
https://github.com/lab-yue/next-cssnano-merge-rules-bug
To Reproduce
- see built https://github.com/lab-yue/next-cssnano-merge-rules-bug/blob/main/.next/static/css/0ac7a32f9d4628e6.css has
.a, .b { line-height: 22px; }breaks origin css priority in https://github.com/lab-yue/next-cssnano-merge-rules-bug/blob/main/src/styles/repro.css
.b {
font: inherit;
font-size: 14px;
line-height: 22px;
/* ...other reset properties... */
}
To build again:
pnpm install
pnpm build
pnpm start
Current vs. Expected behavior
Current: new rule created
Expected: .b should kept line-height: 22px; inside.
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 25.5.0: Mon Apr 27 20:41:15 PDT 2026; root:xnu-12377.121.6~2/RELEASE_ARM64_T6041
Available memory (MB): 65536
Available CPU cores: 16
Binaries:
Node: 24.12.0
npm: 11.11.0
Yarn: 1.22.22
pnpm: 11.9.0
Relevant Packages:
next: 16.2.10 // There is a newer version (16.2.11) available, upgrade recommended!
eslint-config-next: N/A
react: 19.2.4
react-dom: 19.2.4
typescript: 5.9.3
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
CSS
Which stage(s) are affected? (Select all that apply)
next build (local)
Additional context
I think the bug comes form builtin postcss-merge-rules and next/dist/compiled/cssnano-simple
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reproduction repository, especially src/styles/repro.css and the generated .next/static/css/0ac7a32f9d4628e6.css, then trace the next build path through the bundled cssnano-simple and postcss-merge-rules code. Verify the behavior with the provided pnpm install, pnpm build, and pnpm start commands; done means the built output preserves .b’s line-height rather than incorrectly extracting it into a merged rule.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css, next.js
- Domain
- build-system, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100