Skip to content

Instantly share code, notes, and snippets.

@mikestreety
Last active January 2, 2016 09:09
Show Gist options
  • Save mikestreety/8281094 to your computer and use it in GitHub Desktop.
Save mikestreety/8281094 to your computer and use it in GitHub Desktop.
An unnecessarily complex font face dec
// ----
// Sass (v3.3.0.rc.1)
// Compass (v0.13.alpha.10)
// ----
@mixin font-face($font-name, $file, $svg-font-name: false, $weight: 100, $style: normal) {
@font-face {
$font-src: false;
$font-list: (
'eot?#iefix' 'embedded-opentype',
'woff' 'woff',
'ttf' 'truetype'
);
@if($svg-font-name) {
$font-list: $font-list, 'svg##{$svg-font-name}' 'svg';
}
@each $font in $font-list {
$extension: nth($font, 1);
$format: nth($font, 2);
$font-src: $font-src, url('#{$file}.#{$extension}') format('#{$format}');
}
font-family: quote($font-name);
src: url('#{$file}.eot');
src: $font-src;
font-weight: $weight;
font-style: $style;
}
}
@include font-face('Helvetica Neue Lite', fonts/helveticaneueltstd-th-webfont, helvetica_neue_lt_std35_thin, 100, 200);
@font-face {
font-family: "Helvetica Neue Lite";
src: url("fonts/helveticaneueltstd-th-webfont.eot");
src: false, url('fonts/helveticaneueltstd-th-webfont."eot?#iefix" "embedded-opentype"') format('"woff" "woff"'), url("fonts/helveticaneueltstd-th-webfont.svg#helvetica_neue_lt_std35_thin") format("svg");
font-weight: 100;
font-style: 200;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment