$fontName: "Raleway"; $fontId: "raleway"; $style: normal; $display: swap; $weight: 400; $fontDir: "~@fontsource/#{$fontId}/files"; $unicodeMap: (cyrillic-ext: (U+0460-052F,U+1C80-1C88,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F), cyrillic: (U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116), vietnamese: (U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+1EA0-1EF9,U+20AB), latin-ext: (U+0100-024F,U+0259,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF), latin: (U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD)); @mixin fontFace( $fontName: $fontName, $fontId: $fontId, $style: $style, $display: $display, $weight: $weight, $fontDir: $fontDir, $unicodeMap: $unicodeMap ) { @each $subset, $unicodeRangeValues in $unicodeMap { @font-face { font-family: "#{$fontName}"; font-style: $style; font-display: $display; font-weight: $weight; src: url("#{$fontDir}/#{$fontId}-#{$subset}-#{$weight}-#{$style}.woff2") format("woff2"), url("#{$fontDir}/#{$fontId}-all-#{$weight}-#{$style}.woff") format("woff"); unicode-range: $unicodeRangeValues; } } } $defSubset: "latin"; $unicodeRange: false; $unicodeRangeValues: (U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD); @mixin fontFaceCustom( $fontName: $fontName, $fontId: $fontId, $style: $style, $display: $display, $weight: $weight, $woff2Path: null, $woffPath: null, $unicodeRange: $unicodeRange, $unicodeRangeValues: $unicodeRangeValues ) { @if $woffPath == null { $woffPath: "#{$fontDir}/#{$fontId}-#{$defSubset}-#{$weight}-#{$style}.woff"; } @if $woff2Path == null { $woff2Path: "#{$fontDir}/#{$fontId}-#{$defSubset}-#{$weight}-#{$style}.woff2"; } @font-face { font-family: "#{$fontName}"; font-style: $style; font-display: $display; font-weight: $weight; src: url("#{$woff2Path}") format("woff2"), url("#{$woffPath}") format("woff"); @if $unicodeRange { unicode-range: $unicodeRangeValues; } } } $fontNameVariable: "RalewayVariable"; $weightVariable: 100 900; $type: "wghtOnly"; $stretch: null; @mixin fontFaceVariable( $fontName: $fontNameVariable, $fontId: $fontId, $style: $style, $display: $display, $weight: $weightVariable, $fontDir: $fontDir, $type: $type, $stretch: $stretch, $unicodeMap: $unicodeMap ) { @each $subset, $unicodeRangeValues in $unicodeMap { @font-face { font-family: "#{$fontName}"; font-style: $style; font-display: $display; font-weight: $weight; @if $type == "full" { font-stretch: $stretch; } src: url("#{$fontDir}/#{$fontId}-#{$subset}-variable-#{$type}-#{$style}.woff2") format("woff2"); unicode-range: $unicodeRangeValues; } } } @mixin fontFaceVariableCustom( $fontName: $fontNameVariable, $fontId: $fontId, $style: $style, $display: $display, $weight: $weightVariable, $woff2Path: null, $unicodeRange: $unicodeRange, $unicodeRangeValues: $unicodeRangeValues ) { @if $woff2Path == null { $woff2Path: "#{$fontDir}/#{$fontId}-#{$defSubset}-variable-#{$type}-#{$style}.woff2"; } @font-face { font-family: "#{$fontName}"; font-style: $style; font-display: $display; font-weight: $weight; @if $type == "full" { font-stretch: $stretch; } src: url("#{$woff2Path}") format("woff2"); @if $unicodeRange { unicode-range: $unicodeRangeValues; } } }