M
M
Michael R.2018-10-31 11:12:46
Sass
Michael R., 2018-10-31 11:12:46

How to check negation in SASS (SCSS)?

Greetings!
I created a test mixin for demonstration and set a condition for the presence of $arg to it:

@mixin test($arg) {
  @if($arg) {
    @error $arg;
  }
}

If $arg comes in, then the check passes. I'm trying to negate $arg and get a syntax error:
@mixin test($arg) {
  @if(!$arg) {
    @error $arg;
  }
}

How to correctly check negation in SASS (SCSS)?
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew, 2018-10-31
@Mike_Ro

@mixin test($arg) {
  @if(not $arg) {
    @error $arg;
   }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question