I have the following SASS code
.twitter-icon {
position: relative;
&:before {
@include icon($twitter);
position: absolute;
}
}
.facebook-icon {
position: relative;
&:before {
@include icon($facebook);
position: absolute;
}
}
.linkedin-icon {
...
I thought to optimize it with a SASS Mixin that generates different css classes and icon-fonts depending by passed parameters.
I started to write it as below, but I don't know how to replace native Bootstrap 2.3.2 @include icon($twitter);
with the generic @include icon($social-icon);
to have different CSS classes with different imported icons.
Actual solution works only for CSS selector .#{$social-name}-icon
@mixin socialIcons($social-name, $social-icon) {
.#{$social-name}-icon {
position: relative;
&:before {
@include icon($social-icon);
position: absolute;
}
}
}
@include socialIcons(twitter, twitter-sign);
The problem is that I need that $social-icon
could contain a variable (please, look at my original code) such as $twitter
, $facebook
, ...
and not a simple string.