Is it possible to overload mixins in sass?

前端 未结 3 876
感动是毒
感动是毒 2021-02-04 00:59

Let say you have a mixin for shadow like such:

@mixin box-shadow($offset, $blur, $color)
{
   -moz-box-shadow: $offset $offset $blur $color;
   -webkit-box-shado         


        
3条回答
  •  逝去的感伤
    2021-02-04 01:17

    @numbers1311407 solution is correct, but you can use the @each directive to create a shorter mixin:

    @mixin box-shadow($offset, $blur, $color: #999) {
      @each $prefix in -moz-, -webkit-, null {
        #{$prefix}box-shadow: $offset $offset $blur $color;
      }
    }
    

提交回复
热议问题