I am trying to write something like this :
@mixin variableChild($child:".theChild") {
//some css
$child {
//css specific to the child
}
}
#parent { @include variableChild(".specificChild"); };
So it would generate this CSS :
#parent {//some css}
#parent .specificChild {
//css specific to the child
}
You were almost right, you just missed the #{}
around your child selector I think. There's more information about it in the Sass documentation .
@mixin variableChild($child:".theChild") {
#{$child} {
color: red;
}
}
#parent {
@include variableChild(".specificChild");
};
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.