本文介绍了使用SASS& OOCSS参考的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
通常,我在项目中使用 LESS ,但现在我尝试使用 SASS .
Usually i use LESS for my projects but now im trying to go with SASS.
我很少做这样的事情
.module {
background-color: blue;
&-title {
color: black;
}
&-type-2 {
background-color: red;
}
}
,输出的CSS将是
.module {
background-color: blue;
}
.module-title {
color: black;
}
.module-type-2 {
background-color: red;
}
在SASS中不起作用,有某种方法可以在SASS中完成吗?
In SASS wont work, there is someway to do it in SASS?
推荐答案
从Sass 3.3开始,您可以使用以下语法进行操作:
As of Sass 3.3, you can do that with the following syntax:
.block{
&__element {
// ...
}
&--modifier {
// ...
}
}
这篇关于使用SASS& OOCSS参考的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!