Ich möchte eine Variable und eine Zeichenfolge in eine neue Variable fusionieren, wie folgt aus:Merge-String und Variable auf eine Variable mit SASS
$product_bodyclass_list: class1 class2 class3 class4;
$product_class1_color: #C00;
$product_class2_color: #00C;
$product_class3_color: #0C0;
$product_class4_color: #000;
@each $bodyclass in $product_bodyclass_list {
.page-#{$bodyclass} {
a {
color: $product_#{$bodyclass}_color; // This is wrong
}
}
}
Weiß jemand, wie dies zu tun?
Das funktioniert! Super! Thnx! – sneeky
Sie könnten auch das erste Beispiel cleaner machen, indem Sie 'color: nth ($ product-colors, index ($ products, $ class))' –
@bookcasey dafür verwenden. Ich habe deine zweite Option benutzt –