SASS How to set a Variable to equal nothing?

后端 未结 3 1185
一向
一向 2020-12-29 02:32

I am trying to create a variable that is equal to nothing. I have tried the following..

$false:null;

-and-

$false:\" \";
         


        
3条回答
  •  孤城傲影
    2020-12-29 03:13

    null or false will work (null is new in the latest version of Sass). Both will work for your example. The only advantage of null is that it disappears if you use it with a property.

    @mixin myMixin($myVariable: false, $myOtherVariable: false){
      @if not $myVariable {
         //do something
      } @else {
        //do something else
      }
    }
    
    @include myMixin(false, $myOtherVariable);
    

提交回复
热议问题