Skip to content

Instantly share code, notes, and snippets.

@szeidler
Created November 18, 2014 15:01
Show Gist options
  • Select an option

  • Save szeidler/62ba9b350b425d1dc5f2 to your computer and use it in GitHub Desktop.

Select an option

Save szeidler/62ba9b350b425d1dc5f2 to your computer and use it in GitHub Desktop.
Generate @font-face for a whole font familiy in several file formats.
/*
* See: http://www.oliverdavies.co.uk/blog/include-css-fonts-using-sass-each-loop
* Usage: font-family: "FuturaBook";
*/
@each $family in FuturaBook, FuturaBold, FuturaBoldItalic, FuturaItalic {
@font-face {
font-family: #{$family};
src: url('../fonts/#{$family}/#{$family}.eot');
src: url('../fonts/#{$family}/#{$family}.eot?#iefix') format('embedded-opentype'),
url('../fonts/#{$family}/#{$family}.woff') format('woff'),
url('../fonts/#{$family}/#{$family}.ttf') format('truetype'),
url('../fonts/#{$family}/#{$family}.svg##{$family}') format('svg');
font-weight: normal;
font-style: normal;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment