css/scss:有没有办法清理它并使其干燥?

css/scss: is there a way to clean this up and make it dryer?

我有一个 class contentisActive。我是否必须像下面那样“包含”mixin 两次,以便在我有 <div class="content"><div class="content isActive">

这样的元素时应用它
 .content {
    padding: 0 40px;

    &.isActive {
      padding: 20px 40px;
      background: black;
      color: $color-white;
      border-right: none;

      .meta {
        border-bottom: none;
      }

      @include tablet-vertical-down {
        border: 0;
        padding: 0;
      }
    }

    @include tablet-vertical-down {
      border: 0;
      padding: 0;
    }
  }

您可以使用&来引用当前选择器并与&.isActive组合。

.content {
    padding: 0 40px;

    &.isActive {
      padding: 20px 40px;
      background: black;
      color: $color-white;
      border-right: none;

      .meta {
        border-bottom: none;
      }
    }

    &, &.isActive {
      @include tablet-vertical-down {
        border: 0;
        padding: 0;
      }
    }
  }