我想在SASS中動態創建mixins,以列表中的每個項目命名,但似乎不起作用。如何在SASS中定義動態混音或函數名稱?
我試過,但我得到一個錯誤:
$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'嗎?在 –