Reputation: 45
I started using Font Awesome this week, and now there is an update to 4.0. My questions are:
I have been using the mixin in older versions and just updated the name. Is this okay and legal, etc., since I see a lot of name changes?
@mixin fa-FontAwesome() {
font-family: FontAwesome;
font-weight: normal;
font-style: normal;
text-decoration: inherit;
-webkit-font-smoothing: antialiased;
*margin-right: .3em; // fixes ie7 issues
}
Can anyone explain the syntax now used? I appreciate any information as I am new and learning SCSS and Font Awesome.
For example: .#{$fa-css-prefix}
uses a number sign and curly brackets in a class name. I would like to understand the logic behind it.
Upvotes: 2
Views: 3516
Reputation: 35349
Your mixin is just fine.
That syntax uses string interpolation to set the prefix for the Font Awesome base class, which is fa
, via a variable.
For example:
$fa-css-prefix: fa;
.#{$fa-css-prefix} { ... }
Will compile to this css:
.fa { ... }
Which is used this way:
<i class="fa fa-camera-retro"></i>
.fa {
&.fa-camera-retro {
}
}
In theory, using variables, you can set your own prefix. It doesn't have to be fa
.
Upvotes: 2
Reputation: 1858
FontAwesome's updated site explains this really well, just read through the examples page.
Upvotes: 0