MadLittleMods / MadLittleMods/postcss-css-variables

Comma separated rules are unnecessarily expanded (duplicate blocks)

Open
#58 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
JavaScript
Stars
551
Forks
63
PR merge metrics
No merged PRs in 30d

Description

It appears that comma-separated rules are expanded even if the variable value is the same, creating additional unnecessary rules.

Input:
```css
:root {
--font-family: sans-serif;
}

h1, h2, h3, h4, h5, h6 {
font-family: var(--font-family);
}
```

Expected output:
```css
h1, h2, h3, h4, h5, h6 {
font-family: sans-serif;
}
```

Actual output:
```css
h1 {
font-family: sans-serif;
}

h2 {
font-family: sans-serif;
}

h3 {
font-family: sans-serif;
}

h4 {
font-family: sans-serif;
}

h5 {
font-family: sans-serif;
}

h6 {
font-family: sans-serif;
}
```

Contributor guide

No contributing guide indexed for this repository

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 issue with the CSS input and expected output shown in the report, then trace the selector expansion performed by the PostCSS plugin. The work is done when identical resolved declarations remain under one comma-separated selector and the output no longer contains duplicate blocks.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.