Created
March 1, 2015 20:43
-
-
Save julienbourdeau/1235f357d4da4d69d330 to your computer and use it in GitHub Desktop.
Scss Font Face Mixin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mixin font-face($style-name, $file, $family, $category:"") { | |
$filepath: "fonts/" + $family + "/" + $file; | |
@font-face { | |
font-family: "#{$style-name}"; | |
src: url($filepath + ".eot"); | |
src: url($filepath + ".eot?#iefix") format('embedded-opentype'), url($filepath + ".woff") format('woff'), url($filepath + ".ttf") format('truetype'), url($filepath + ".svg#" + $style-name + "") format('svg'); | |
} | |
%#{$style-name} { | |
font: { | |
@if $category != "" { | |
family: "#{$style-name}", #{$category}; | |
} | |
@else { | |
family: "#{$style-name}"; | |
weight: normal; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use this way:
Source : http://clubmate.fi/scss-font-face-mixin/