Skip to content

Instantly share code, notes, and snippets.

@jonnymaceachern
Last active July 14, 2017 18:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonnymaceachern/9f2acb65fe58e4c0b64a to your computer and use it in GitHub Desktop.
Save jonnymaceachern/9f2acb65fe58e4c0b64a to your computer and use it in GitHub Desktop.
Mixin to declare font face for all file types (.eot, .woff, .ttf, .svg)
@mixin declare-font-face($font-family, $font-filename, $font-weight : normal, $font-style :normal, $font-stretch : normal) {
@font-face {
font-family: '#{$font-family}';
src: url(font-path('#{$font-filename}.eot'));
src: url(font-path('#{$font-filename}.eot?#iefix')) format('embedded-opentype'),
url(font-path('#{$font-filename}.woff')) format('woff'),
url(font-path('#{$font-filename}.ttf')) format('truetype'),
url(font-path('#{$font-filename}.svg##{$font-family}')) format('svg');
font-weight: $font-weight;
font-style: $font-style;
font-stretch: $font-stretch;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment