Skip to content

Instantly share code, notes, and snippets.

@mwanberg
Created September 20, 2016 23:42
Show Gist options
  • Save mwanberg/48237cd54bb6bfa64ea040b97945d31a to your computer and use it in GitHub Desktop.
Save mwanberg/48237cd54bb6bfa64ea040b97945d31a to your computer and use it in GitHub Desktop.
Generate @font-face declarations
// Lato
$fonts-path: '../fonts/LatoLatin/fonts';
// List of fonts used
// name_of_font: 'path_of_font'
// Please add only as many as you absolutely need
$font-list: (
LatoLatin-Regular: 'LatoLatin-Regular',
LatoLatin-Bold: 'LatoLatin-Bold'
);
// This generates the @font-face code for each Roboto variation
// and uses the above map list of fonts
@each $fontname, $fontpath in $font-list {
@font-face {
font-family: '#{$fontname}';
src: url('#{$fonts-path}/#{$fontpath}.eot');
src: url('#{$fonts-path}/#{$fontpath}.eot?#iefix') format('embedded-opentype'),
url('#{$fonts-path}/#{$fontpath}.woff') format('woff'),
url('#{$fonts-path}/#{$fontpath}.ttf') format('truetype'),
url('#{$fonts-path}/#{$fontpath}.svg##{$fontname}') 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