MadLittleMods / MadLittleMods/postcss-css-variables

Incorrect output and duplication when defining a variable relative to another

Open
#105 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Inputting the code
```css
@media screen and (min-width: 500px) {
:root {
--defaultFontSize: 2.8vw;
--specialFontSize: var(--defaultFontSize);
}
}

@media screen and (min-width: 600px) {
:root {
--defaultFontSize: 3.8vw;
}
}

body {
font-size: var(--specialFontSize)
}
```

outputs

```css
body {
font-size: undefined
}

@media screen and (min-width: 600px) {

body {
font-size: undefined
}
}

@media screen and (min-width: 500px) {

body {
font-size: 2.8vw
}
}

@media screen and (min-width: 500px) {

body {
font-size: 2.8vw
}
}
```

Note the font-size:undefined in the second declaration. That should be a 3.8vw.

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

Use the CSS example in the issue as the reproduction case; inspect the plugin's custom-property resolution and media-query generation paths. Done means the later media query resolves --specialFontSize to 3.8vw and the generated 500px rule is emitted only once, with no undefined value.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.