Conditions | Sass

Sass Conditions

Sass conditions

Sass if condition

$display: true !default; @mixin simple-mixin{ @if $display{ @debug "$display is #{$display}"; display: block; } @else{ @debug "$display is #{$display}"; display: none; } } .some-selector{ @include simple-mixin; } .some-selector { display: block; }

The if.scss file result the above if.css where as on CLI, this will result following debug information:

if.scss:5 DEBUG: $display is true

Here, if.scss is the file name DEBUG is the level and later one is the message that was printed for debugging purpose