Scrum / postcss-at-rules-variables

PostCss plugin to use CSS Custom Properties in at-rule @each, @for, @if, @else and more...

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is there any way to make this work with postcss-mixins?

sandrina-p opened this issue · comments

I have a mixin made with postcss-mixins and I want to use a css variable as argument, but it isn't working.

:root {
    --padd: 2rem;
}

@define-mixin position $place, $val {
    @if $place == end { right: $(val); }
    @if $place == start { left: $(val); }
}

And then I call it:

.foo1 {
   @mixin position end, 2rem; /* it works -> right: 2rem; */
}

.foo2 {
   @mixin position end, var(--padd); /* doesn't work -> right: var(--padd); - it should output 2rem  */
}

Is is possible for you to make this works with postcss-at-rules-variables?

@sandrina-p Hi, of course, you need use options atRules

require('postcss-at-rules-variables')({ atRules: ['mixin'] })

Thanks, it worked!