我正在使用指南針來管理mac osx上的一些sass文件。我有這些文件:使用僞選擇器擴展Sass
sass/
screen.scss
partials folder/
...
_fonts.scss
_functions.scss
...
在字體我有這樣的規則,我想重用@extend。
//fonts.scss
.icon-ab-logo, {
font-family: 'icomoon';
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
}
.icon-ab-logo:before { //i want to reuse this.
content: "\e000";
}
在功能我有這個screen.scss:
.logo {
position: absolute;
top: 0;
bottom: 0px;
z-index: 500;
width: 9.5em;
background: $logo;
@include transition(all 0.2s);
&:after{
@include icon(".icon-ab-logo");
}
}
終於在functions.scss我稱之爲:
@mixin icon($icon){
font-family: 'icomoon';
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
@extend #{$icon}:before; //<- this is the problem, no errors just isn't parsed.
}
是否有參考.icon-AB-方式標誌:在使用mixin之前?解決方法? 感謝您的閱讀。
這是行不通的。但是,如你所說,這不是一個好主意。感謝您花時間回答我的問題。 – Simon