문제

Usually i use LESS for my projects but now im trying to go with SASS.

In LESS i do things like this

.module {
  background-color: blue;

  &-title {
    color: black;
  }

  &-type-2 {
    background-color: red;
  }
}

and the output CSS will be

.module { 
  background-color: blue;
}

.module-title {
  color: black;
}

.module-type-2 {
  background-color: red;
}

In SASS wont work, there is someway to do it in SASS?

도움이 되었습니까?

해결책

As of Sass 3.3, you can do that with the following syntax:

.block{
    &__element {
      // ...
    }
    &--modifier {
      // ...
    }
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top