简体   繁体   中英

SASS is not compiling the appropriate CSS

I am getting some non-sensical output from sass regarding these few lines.

@mixin full_shadow($size, $color){
  text-shadow : $size 0 0 $color, -$size 0 0 $color, 0 $size 0 $color, 0 -$size 0 $color;
}

p {
  @include full_shadow(1.25px, red);
}

Here's what is weird

p { /* Expected Output */
  text-shadow: 1.25px 0 0 red, -1.25px 0 0 red, 0 1.25px 0 red, 0 -1.25px 0 red;
}

p { /* SASS Output*/
  text-shadow: 1.25px 0 0 red, -1.25px 0 0 red, 0 1.25px 0 red, -1.25px 0 red;
}

It's not immediately obvious, but the SASS output is missing a term at the very end of the property assignment.

... , -$size 0 $color; does not equal the defined ..., 0 -$size 0 $color;

Any insight on this would be great. Thanks!

It's being interpreted as a subtraction: 0 - $size . Use parentheses to force unary minus:

0 (-$size) 0 $color

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM