Wolfr
Wolfr

Reputation: 5164

SCSS if directive: how to pass multiple variables?

How would I write this code so I check for both the truthiness of $text-shadows as well as $shadows?

.btn {
  @if $text-shadows {
    @include text-shadow-black;
  }
  @if $shadows {
    @include shadow-white;
  }
 }

To be clear, what I want to achieve is this without nesting:

.btn {
  @if $text-shadows {
    @if $shadows {
      @include text-shadow-black;
    }
   }
 } 

Upvotes: 0

Views: 231

Answers (1)

cimmanon
cimmanon

Reputation: 68339

You're looking for the and keyword:

.btn {
  @if $text-shadows and $shadows {
      @include text-shadow-black;
  }
}

Upvotes: 2

Related Questions