I am using PostCSS and I am using it as in the documentation but I am using it as inside a function in a separate file called variables, when I execute it I get:
Failed to parse expression
Here I have it like this in the css
variables.css
@define-mixin backImages $x, $y, $url, $color, $size, $repeat{
if $color != ''{
background-color: $(color);
}
@else if $url != ''{
background-image: $(url);
}
@else if $x != '' && $y != ''{
background-position: $(x) $(y);
}
@else if $size != ''{
background-repeat: $(repeat);
}
@else if $repeat != ''{
background-size: $(size);
}
@else{
background:none;
}
}
styles.css
body{
@mixin backImages center, center, url(../images/juego_img/logojuego.png), '', cover, no-repeat;
position: relative;
background: blue;
}
I don't know what mistake I'm making.
The operation of the mixins are very simple. What you should do is close them
@else
with the corresponding braces.Example: https://runkit.com/jondotsoy/example-mixins-with-postcss-and-precss