Created
August 31, 2018 12:59
-
-
Save dreamyguy/764553bfd290bb8699f21ed61dc7c22d to your computer and use it in GitHub Desktop.
SCSS Webfont pattern
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
$font-fallback: arial, sans-serif; | |
$path-fonts: '../fonts'; | |
.font-defaults { | |
font-weight: normal; | |
font-style: normal; | |
-webkit-font-smoothing: antialiased; | |
} | |
@font-face { | |
font-family: 'AzoSansBlack'; | |
src: url('#{$path-fonts}/AzoSans-Black-webfont.eot'); | |
src: url('#{$path-fonts}/AzoSans-Black-webfont.eot?#iefix') format("embedded-opentype"), url('#{$path-fonts}/AzoSans-Black-webfont.woff') format("woff"), url('#{$path-fonts}/AzoSans-Black-webfont.ttf') format("truetype"), url('#{$path-fonts}/AzoSans-Black-webfont.svg#AzoSansBlack') format("svg"); | |
@extend .font-defaults; | |
} | |
@font-face { | |
font-family: 'AzoSansLight'; | |
src: url('#{$path-fonts}/AzoSans-Light-webfont.eot'); | |
src: url('#{$path-fonts}/AzoSans-Light-webfont.eot?#iefix') format("embedded-opentype"), url('#{$path-fonts}/AzoSans-Light-webfont.woff') format("woff"), url('#{$path-fonts}/AzoSans-Light-webfont.ttf') format("truetype"), url('#{$path-fonts}/AzoSans-Light-webfont.svg#AzoSansLight') format("svg"); | |
@extend .font-defaults; | |
} | |
@font-face { | |
font-family: 'AzoSansLightItalic'; | |
src: url('#{$path-fonts}/AzoSans-Light-Italic-webfont.eot'); | |
src: url('#{$path-fonts}/AzoSans-Light-Italic-webfont.eot?#iefix') format("embedded-opentype"), url('#{$path-fonts}/AzoSans-Light-Italic-webfont.woff') format("woff"), url('#{$path-fonts}/AzoSans-Light-Italic-webfont.ttf') format("truetype"), url('#{$path-fonts}/AzoSans-Light-Italic-webfont.svg#AzoSansLightItalic') format("svg"); | |
@extend .font-defaults; | |
} | |
@font-face { | |
font-family: 'AzoSansMedium'; | |
src: url('#{$path-fonts}/AzoSans-Medium-webfont.eot'); | |
src: url('#{$path-fonts}/AzoSans-Medium-webfont.eot?#iefix') format("embedded-opentype"), url('#{$path-fonts}/AzoSans-Medium-webfont.woff') format("woff"), url('#{$path-fonts}/AzoSans-Medium-webfont.ttf') format("truetype"), url('#{$path-fonts}/AzoSans-Medium-webfont.svg#AzoSansMedium') format("svg"); | |
@extend .font-defaults; | |
} | |
.font-azo-black { | |
font-family: 'AzoSansBlack', $font-fallback; | |
} | |
.font-azo-light { | |
font-family: 'AzoSansLight', $font-fallback; | |
} | |
.font-azo-light-italic { | |
font-family: 'AzoSansLightItalic', $font-fallback; | |
} | |
.font-azo-medium { | |
font-family: 'AzoSansMedium', $font-fallback; | |
} | |
// User cases: | |
// | |
// 1. | |
// <p class="font-azo-medium">A Very Special P</p> | |
// | |
// 2. | |
// h2 { | |
// font-size: 38px; | |
// line-height: .8; | |
// @extend .font-azo-medium; | |
// } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment