SASS variables and inheritance

前端 未结 4 429
盖世英雄少女心
盖世英雄少女心 2021-01-07 03:13

Suppose I have two virtually identical HTML structures, but with different class names. They only differ by a few variables, like width and h

4条回答
  •  攒了一身酷
    2021-01-07 04:00

    Ran into the same problem, this is how I'm going to try to solve it... (this works)

    @mixin foo($type:"default")
      .mClass
        $bg: inherit
        @if $type == "banana"
          $bg: yellow
    
        background: $bg
    
    .firstClass
      @include foo
    .secondClass
      @include foo("banana")
    

提交回复
热议问题