Currently, I am working on a mixin that will target a specific child element within a parent. For instance, my goal is to target all <a>
tags within a parent element that also has a parent of section---blue
.
I initially thought that passing the tag as an argument would work, but unfortunately, I haven't achieved the desired outcome.
SCSS
@mixin themeParent ($child) {
&--blue $child {
color: getColour("theme", "bluehighlight");
}
&--green $child {
color: getColour("theme", "greenhighlight");
}
&--purple $child {
color: getColour("theme", "purplehighlight");
}
}
.section {
@include themeParent(a);
}
My expectation was that this code snippet would compile to:
.section--blue a {
color: blue;
}
If anyone can help me understand why it does not work as expected, I would greatly appreciate it.