SASS Variable within string [duplicate]

Yes, you just have to use variable interpolation. Example:

@mixin post-link ($class, $color, $hover) {
    a.#{$class}:link {
        color: $color;
    }
    a.#{$class}:hover {
        color: $hover;
    }
}

Example on SassMeister: http://sassmeister.com/gist/9533103

The key is adding #{ and } around your variable names to get them expanded.

Leave a Comment