Last active
December 14, 2015 10:39
-
-
Save stormwarning/5074086 to your computer and use it in GitHub Desktop.
Opinionated @font-face SASS mixin for embedding with better style and weight control.
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
/** | |
* Embed @font-face with better style and weight control. | |
* | |
@include font-specimen(OpenSans, normal, 300); | |
@include font-specimen(OpenSans, normal, 400); | |
@include font-specimen(OpenSans, italic, 600); | |
* | |
* Depends on a specific filename scheme; edit the `url` paths to match your setup. | |
* | |
*/ | |
@mixin font-specimen($font-name, $font-style, $font-weight) { | |
@font-face { | |
font-family: '#{$font-name}'; | |
src: url('#{$font-name}--#{$font-style}-#{$font-weight}.eot'); | |
src: url('#{$font-name}--#{$font-style}-#{$font-weight}.eot?#iefix') format('embedded-opentype'), | |
url('#{$font-name}--#{$font-style}-#{$font-weight}.woff') format('woff'), | |
url('#{$font-name}--#{$font-style}-#{$font-weight}.svg##{$font-name}--#{$font-style}-#{$font-weight}') format('svg'); | |
font-style: $font-style; | |
font-weight: $font-weight; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment