You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.
If I stop using postcss-simple-vars the postcss-each package works and I am getting no errors. But configured like this, postcss-simple-vars should actually not see the @\each rules statements, shouldn't they?
Thanks in advance!
The text was updated successfully, but these errors were encountered:
Okay now I've managed to get a minimal example working and figured out some detail about the issue. First of all I mixed up the plugin order. afterEach is obviously called BEFORE the at-each statements are resolved. Maybe a note in the docs explaining this also on the example of simple-vars would be helpful to others. However, as simple-vars thinks the $i were its variables it starts to complain.
My minimal example working with beforeEach instead of afterEach in postcss config:
$black:#010101;
$white:#fff;
body {
background-color: $black
}
@each $i in 1,2,4,8,16 {
body.m$(i) {
background-color: $white;
margin: $(i)px;
}
}
BUT there is another issue. As soon as I nest multiple each definitions, the error comes back within the inner at-each. This makes sense as after the resolving of the outer at-each simple-vars is being called and faces the same issue as mentioned initially. Example:
$black:#010101;
$white:#fff;
body {
background-color: $black
}
@each $i in 1,2,4,8,16 {
@each $j in 1,2,3,4 {
body.m$(i)-$(j) {
background-color: $white;
margin: $(i)px;
}
}
}
produces
TLDR; How can we use this package together with @postcss-simple-vars AND use nested at-each statements? :) @madyankin
hendriku
changed the title
Usage together with postcss-simple-vars
postcss-simple-vars unknown variable when using nested loops
Oct 20, 2021
After digging in to this issue I decided to configure simple-vars to emit a warning only if the node exists after all of the plugins run.
require('postcss-simple-vars')({unknown(node,name,result){// Print out warning if the node still exists at the end.node.warn(result,'Unknown variable '+name);}}),
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hello there, we'd like to use this plugin together with postcss-simple-vars. This is supported, right?
I am currently getting this error in one of my postcss files:
with the following as my config:
If I stop using postcss-simple-vars the postcss-each package works and I am getting no errors. But configured like this, postcss-simple-vars should actually not see the @\each rules statements, shouldn't they?
Thanks in advance!
The text was updated successfully, but these errors were encountered: