最近开始用sass,遇到了一个问题,看一下下面的代码
@import 'base.scss';
.btn {
@extend reset-btn;
}
在base.scss
文件里面,有很多已经写好的选择器,但是,我只用到一个reset-btn
,在这种情况下,我还是把整个base.scss
文件里面所有的内容全部导了进来,就会有很多重复并且我用不到的代码,这种情况下,我该怎么解决呢?
怪我咯2017-04-17 11:41:28
If it is a written selector
`
.selector {
}
`
it will be used. No solution
So the imported files are best mixedin
or this kind of
`
%selector {
}
`
sass virtual class form
怪我咯2017-04-17 11:41:28
sass
will not have duplicate code. You will know after compiling it into css
and taking a look. Although we may have defined many mixin
, they will not be converted when they are not actually used in the project. into css
, like here, the final generated css
will only be reset-btn
related to css