我想在SASS中动态创建Mixin,以列表中的每个项目命名,但似乎不起作用。
我尝试了这个方法,但是出现了错误:
$event-icons: fair, concert, art-show, conference, dance-show, film, party, festival, theatre, launch
@each $event-icon in $event-icons
@mixin event-icon-#{$event-icon}
background-position: -($event-icon-width * $i) 0
错误:
Invalid CSS after "": expected expression (e.g. 1px, bold), was "#{$event-icon}"
这种用法SASS不支持吗?我在手册中找不到任何关于它的内容。
@mixin
吗?请看下面的答案。 - Stuart M