I have a set up where I'd like to select elements based on partial class in scss.
I know of the wildcard selector which I could use div[class*='-suffix']
however within the class definition, I'd like to use that wildcard value. For example:
.{prefix}-glyph
{
@include mymixin({prefix})
}
Where {prefix} is the wildcard prefix I wish to match against.
Is this possible?
What you are trying to do, though don't see why you would want to do this? Its requires more typing:
Mixin
@mixin myMixin($name) {
.#{$name}-name {
@content;
}
}
Usage
@include myMixin(class) {
// YOUR STYLES
};
Output
.class-name {
// YOUR STYLES
}
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.