Font Include Mixin

Help create include font face tags with SCSS

Get webfonts for your project in the following formats - EOT, SVG, WOFF and TTF. Save them where you would like in your project.

Embed this mixin within your code.

@mixin importfont($font-family, $font-filename, $font-weight : normal, $font-style :normal, $font-stretch : normal) {
  @font-face {
    font-family: '#{$font-family}';
    src: url('#{$font-filename}.eot');
    src: url('#{$font-filename}.eot?#iefix') format('embedded-opentype'),
    url('#{$font-filename}.woff') format('woff'),
    url('#{$font-filename}.ttf') format('truetype'),
    url('#{$font-filename}.svg##{$font-family}') format('svg');
    font-weight: $font-weight;
    font-style: $font-style;
    font-stretch: $font-stretch;
  }
}
  

Call the mixin and pass in the font name, and the path to your font.

@include importfont('Font Name', 'fonts/fontfilename', 400);

PROFIT