Sass store selector in variable

2019-01-20 09:24发布

问题:

I am trying to save a selector in SASS for easier referencing later, however I get a syntax error.

Here's what I'm trying to do:

$icon:  [class*="icon"];

回答1:

You need to convert it to a string if you want to use it as a variable:

$icon: '[class*="icon"]';

#{$icon} {
    // stuff
}


标签: css sass