I'm just pulling my hair right know.
I have a mixing that receives a simple object. Depending on the value of one of the properties should enter inside de IF statement or the ELSE one. However it's always evaluating as TRUE and can't figure why.
Code is compiled using node-sass (libsass v3.5.4 ) and the gist can be seen here:
https://www.sassmeister.com/gist/40eb28fd55173d7534a7162de3c1b960
Both times calculateHeight mixin is invoked evaluates the if to TRUE and creates a CSS with twice color: red, instead of color: red and color: blue
// ----
// libsass (v3.5.4)
// ----
$headerHeight: 150px;
$headerHeightM: 115px;
$headerHeightS: 100px;
@mixin calculateHeight($obj:()){
@if #{map-get($obj, value)} {
color: red;
@media (min-width: 480px) {
#{map-get($obj, property)}: $headerHeightS;
}
@media (min-width: 768px) {
#{map-get($obj, property)}: $headerHeightM;
}
@media (min-width: 1280px) {
#{map-get($obj, property)}: $headerHeight;
}
}
@else {
color: blue;
@media (min-width: 480px) {
#{map-get($obj, property)}: #{map-get($obj, value)} 233px;
}
}
}
.header{
@include calculateHeight((property: 'height', value: false));
@include calculateHeight((property: "background", value: "url('../img/red_header_wave_1.png') no-repeat center top/100% "));
}