1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-03 15:16:40 -04:00

playing with variable fonts some more

This commit is contained in:
2020-07-23 13:03:00 -04:00
parent 5b005f8186
commit cdfbba108c
7 changed files with 46 additions and 37 deletions

View File

@ -17,13 +17,20 @@
}
// Web fonts (see components/_typography.scss)
@mixin font-face($family, $src, $weight: normal, $style: normal, $display: swap) {
@mixin font-face($family, $src, $weight: normal, $style: normal, $display: swap, $variable: false) {
@font-face {
font-family: $family;
font-style: $style;
font-weight: $weight;
font-display: $display;
src: url($base-url + $src + ".woff2") format("woff2"), url($base-url + $src + ".woff") format("woff");
@if $variable {
// all browsers that support variable fonts also support woff2, so a woff file is unncessary
// draft spec for formats: https://www.w3.org/TR/css-fonts-4/#src-desc
src: url($base-url + $src + ".woff2") format("woff2-variations"), url($base-url + $src + ".woff2") format("woff2");
} @else {
src: url($base-url + $src + ".woff2") format("woff2"), url($base-url + $src + ".woff") format("woff");
}
// Allow additional rules to be passed in:
@content;