[問題] 如何改成精簡的寫法

作者: ponba (胖爸)   2014-07-08 11:04:07
@include icon("icon-library", "\e621", $pon-icon);
@include icon("icon-calculate", "\e63a", $pon-icon);
@include icon("icon-clock", "\e648", $pon-icon);
@include icon("icon-bars", "\e698", $pon-icon);
@include icon("icon-cog2", "\e690", $pon-icon);
上面是設定值,下面是想要變成的CSS
.pon-icon-library:before {
font-family: $pon-icon;
content: "\e621";
}
目前有想到的方式為
@mixin pon-icon($icon){
font-family: $pon-icon;
content: $icon;
}
.pon-icon-library:before { @include pon-icon("\e621"); }
請問如何用類似迴圈或其它較精簡的方式改寫?
如果可用for-each直接把@include icon的值抓出來就好了。
謝謝
作者: mars90226 (火星人)   2014-07-08 14:13:00
你po錯版了?雖然說應該是SASS,不過Web_Design版應該更好就是了
作者: ponba (胖爸)   2014-07-08 22:21:00
謝謝

Links booklink

Contact Us: admin [ a t ] ucptt.com