Abel
Abel

Reputation: 1614

Match class name in SCSS

I want to match some strings in my class name using mixin. It works without mixins, but when I used mixin, I can't pass the variable into the string.

What was working

div[class^='myclass-'], div[class*=' myclass-'] {
  @content
}

What doesn't work

@mixin startWith($name){
 div[class^=$name], div[class*=' ' + $name'] {
  @content;
 }
}

Upvotes: 0

Views: 493

Answers (1)

Aslam
Aslam

Reputation: 9680

There is a typo in your code. Use this

@mixin startWith($name){
 div[class^=$name], div[class*=$name] {
  @content;
 }
}

Upvotes: 1

Related Questions