`Undefined variable` inside function
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 30/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- css, javascript
Research direction
Reproduce the report using postcss.config.js and the shown main.pcss, colors.pcss, components/flash.pcss, and components/forms.pcss files. Start by checking how imported files are processed and how postcss-simple-vars scopes variables; done means determining whether the reported undefined variable is reproducible and documenting or fixing the behavior.
Written by the indexing model from the issue text.
Description
Hello.
I have such files:
// postcss.config.js
module.exports = {
plugins: [
require('postcss-import')({
root: `${__dirname}/assets/styles`
}),
require('postcss-simple-vars'),
require('postcss-conditionals'),
require('postcss-nested'),
require('postcss-flexbugs-fixes'),
// require('postcss-color-mod-function'),
require('autoprefixer')
]
}
/* main.pcss */
@import 'colors.pcss';
@import 'components/flash.pcss';
@import 'components/forms.pcss';
/* ... */
/* colors.pcss */
$danger-text-color: red;
$error-color: $danger-text-color;
/* components/flash.pcss */
.flash {
&.error {
color: $error-color;
}
}
/* components/forms.pcss */
form {
p.error {
color: color-mod($error-color whiteness(15%));
}
}
And I'm getting such error:
CssSyntaxError: postcss-simple-vars: /home/alex/Projects/ruby/test/foo_bar/assets/styles/components/forms.pcss:22:3: Undefined variable $error-color
20 | margin: 0;
21 | padding-left: 0.4em;
> 22 | color: color-mod($error-color whiteness(15%));
| ^
23 | }
24 |
- Dominant language
- JavaScript
- Stars
- 428
- Forks
- 35
- Avg merge
- 1m
- Merged PRs (30d)
- 1
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- No pull request template
- No contributing 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.
More from postcss/postcss-simple-vars
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
postcss/postcss-simple-vars#109 · 5 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 28/100
postcss/postcss-simple-vars#75 · 6 comments · 1 reaction ·
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 35/100
postcss/postcss-simple-vars#12 · 6 comments · 2 reactions ·
All issues in postcss/postcss-simple-vars
Similar issues
-
[Bug] Composer can submit an IME confirmation when keyCode is 229 but isComposing is falsePossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
apache/rocketmq-dashboard#6067 ·
Maintainers usually reply within 4 days
-
severity: low
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
luainkernel/lunatik#1853 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
factory-active factory-automatic harness/claude-code task-identify-harness-labels-done task-identify-issue-type-done
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day