MadLittleMods / MadLittleMods/postcss-css-variables
Chaining variables in media queries results in duplicated blocks
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 551
- Forks
- 63
- PR merge metrics
- No merged PRs in 30d
Description
The issue might seem related to https://github.com/MadLittleMods/postcss-css-variables/issues/64, the difference being that there is no problem with nesting in the example below.
The issue can be replicated in the playground with the following input:
:root {
--space-small: 10px;
--space-large: 20px;
}
@media (min-width: 768px) {
:root {
--space-small: 20px;
--space-large: 30px;
}
}
h1 {
padding: var(--space-small) var(--space-large);
}
h2 {
padding: var(--space-small);
}
In the output, the h2 is defined as expected, while h1's media query block gets duplicated a few times:
h1 {
padding: 10px 20px;
}
@media (min-width: 768px) {
h1 {
padding: 20px 30px;
}
}
@media (min-width: 768px) {
h1 {
padding: 20px 30px;
}
}
@media (min-width: 768px) {
h1 {
padding: 20px 30px;
}
}
@media (min-width: 768px) {
h1 {
padding: 20px 30px;
}
}
If using 3 values for padding, the level of replication is increased.
Contributor guide
No contributing guide indexed for this repository
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
Reproduce the input in the linked playground and compare the generated CSS with the expected output, using issue #64 only as related context. Done means the h1 media query is emitted once, and using three padding values does not increase duplication.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100