Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
font-face mixin override with unicode-range and local('') support.
// ______________________________________________________________________ //
// font-face mixin override //
// ______________________________________________________________________ //
@mixin font-face(
$name,
$font-files,
$eot: false,
$weight: false,
$style: false,
$unicode-range: false,
$local: false
) {
$iefont: unquote("#{$eot}?#iefix");
@font-face {
font-family: quote($name);
@if $eot {
src: font-url($eot);
$font-files: font-url($iefont) unquote("format('embedded-opentype')"), $font-files;
}
@if $local {
src: local(quote($local)), $font-files;
} @else {
src: $font-files;
}
@if $unicode-range {
unicode-range: $unicode-range;
}
@if $weight {
font-weight: $weight;
}
@if $style {
font-style: $style;
}
}
}
@include font-face(
"myfont",
font-files(
"myfont.woff", woff,
"myfont.ttf", opentype,
"myfont.svg#webfontJRppkSIE", svg
),
"myfont.eot",
normal,
normal,
(U+1700-1714, U+1735-1736),
);
@font-face {
font-family: "myfont";
src: url('myfont.eot');
src: local(""), url('myfont.eot?#iefix') format('embedded-opentype'), url('myfont.woff') format('woff'), url('myfont.ttf') format('opentype'), url('myfont.svg#webfontJRppkSIE') format('svg');
unicode-range: U+1700-1714, U+1735-1736;
font-weight: normal;
font-style: normal; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.