0

I am facing a strange behavior of Sass, when the expression of an @if-rule compares a variable with null.

$foo: null;

@debug $foo, $foo == null, $foo != null;

@if $foo == nullĀ {
    @debug "$foo is null";
}

@if $foo != nullĀ {
    @debug "$foo is not null";
}

Output:

DEBUG: null, true, false
DEBUG: $foo is not null

When $foo is null why the second @if-rule will be executed and not the first?

I am using the Dart Sass 1.57.1

Karsten
  • 343
  • 4
  • 12

1 Answers1

0

I just found out, that there was an hidden character in the @if-rule which causes it to be ignored.

Karsten
  • 343
  • 4
  • 12