Using SASS & reference for OOCSS

痞子三分冷 提交于 2019-12-23 19:07:03

问题


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?


回答1:


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

.block{
    &__element {
      // ...
    }
    &--modifier {
      // ...
    }
}


来源:https://stackoverflow.com/questions/18666208/using-sass-reference-for-oocss

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!