1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-04-27 13:56:22 -04:00

simplify SASS @font-face mixin

This commit is contained in:
Jake Jarvis 2020-01-30 00:02:46 -05:00
parent 7edb9fa68b
commit 65bb5b12a5
Signed by: jake
GPG Key ID: 2B0C9CF251E69A39
6 changed files with 45 additions and 38 deletions

View File

@ -13,21 +13,16 @@
}
// Web fonts (see components/_fonts.scss)
// stylelint-disable indentation
@mixin font-face($family, $src, $weight: normal, $range: false, $style: normal, $display: swap) {
@mixin font-face($family, $src, $weight: normal, $style: normal, $display: swap) {
@font-face {
font-family: $family;
font-style: $style;
font-weight: $weight;
font-display: $display;
src: url("#{$src}.woff2") format("woff2"),
url("#{$src}.woff") format("woff");
// src: local("#{$src-local}"), local("#{$src-local-alt}"),
// url('#{$src}.ttf') format('truetype'),
// url('#{$src}.eot') format('embedded-opentype');
@if $range {
unicode-range: U+0000-00FF, U+2000-206F, U+20A0-20CF,
U+2190-21FF, U+2200-22FF, U+2122;
}
url("#{$src}.woff") format("woff"); // stylelint-disable-line indentation
// Allow additional declarations to be passed in:
@content;
}
}

View File

@ -99,4 +99,5 @@ div#content {
// Responsive
@mixin responsive--content() {
// stylelint-disable block-no-empty
}

View File

@ -1,5 +1,10 @@
@charset "UTF-8";
// Note to self: got this list after subsetting Inter with glyphhanger:
// https://github.com/filamentgroup/glyphhanger
// ex: glyphhanger --whitelist="" --family="Inter" --formats=woff2,woff --subset="*.woff"
$unicode-subset: U+0000-00FF, U+2000-206F, U+20A0-20CF, U+2190-21FF, U+2200-22FF, U+2122;
/*!
* Inter typeface v3.11 - https://rsms.me/inter/
*
@ -7,9 +12,15 @@
* Licensed under the SIL Open Font License, Version 1.1:
* https://github.com/rsms/inter/blob/v3.11/LICENSE.txt
*/
@include font-face("Inter", "./fonts/inter-regular-subset", 400, true);
@include font-face("Inter", "./fonts/inter-medium-subset", 500, true);
@include font-face("Inter", "./fonts/inter-bold-subset", 700, true);
@include font-face("Inter", "fonts/inter-regular-subset", 400) {
unicode-range: $unicode-subset;
}
@include font-face("Inter", "fonts/inter-medium-subset", 500) {
unicode-range: $unicode-subset;
}
@include font-face("Inter", "fonts/inter-bold-subset", 700) {
unicode-range: $unicode-subset;
}
/*!
* Hack typeface v3.003 - https://sourcefoundry.org/hack/
@ -18,4 +29,4 @@
* Licensed under the MIT License:
* https://github.com/source-foundry/Hack/blob/v3.003/LICENSE.md
*/
@include font-face("Hack", "./fonts/hack-regular-subset", 400);
@include font-face("Hack", "fonts/hack-regular-subset", 400);

View File

@ -1,6 +1,6 @@
@charset "UTF-8";
/*! Fancy Waving Hand Emoji™ - https://go.jarv.is/wave */
/*! Magic Waving Hand™ - https://go.jarv.is/wave */
span.wave {
display: inline-block;

View File

@ -20,7 +20,7 @@ main#video {
letter-spacing: -0.005em;
line-height: 1.5;
color: #777777;
margin: 1.25em;
margin: 1.25em 1em 0 1em;
a {
font-weight: bold;

View File

@ -207,9 +207,9 @@
integrity sha1-aaI6OtKcrwCX8G7aWbNh7i8GOfY=
"@types/node@*":
version "13.5.0"
resolved "https://registry.yarnpkg.com/@types/node/-/node-13.5.0.tgz#4e498dbf355795a611a87ae5ef811a8660d42662"
integrity sha512-Onhn+z72D2O2Pb2ql2xukJ55rglumsVo1H6Fmyi8mlU9SvKdBk/pUSUAiBY/d9bAOF7VVWajX3sths/+g6ZiAQ==
version "13.5.2"
resolved "https://registry.yarnpkg.com/@types/node/-/node-13.5.2.tgz#3de53b55fd39efc428a901a0f6db31f761cfa131"
integrity sha512-Fr6a47c84PRLfd7M7u3/hEknyUdQrrBA6VoPmkze0tcflhU5UnpWEX2kn12ktA/lb+MNHSqFlSiPHIHsaErTPA==
"@types/normalize-package-data@^2.4.0":
version "2.4.0"
@ -558,13 +558,13 @@ braces@^3.0.1, braces@~3.0.2:
fill-range "^7.0.1"
browserslist@^4.8.3:
version "4.8.5"
resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.8.5.tgz#691af4e327ac877b25e7a3f7ee869c4ef36cdea3"
integrity sha512-4LMHuicxkabIB+n9874jZX/az1IaZ5a+EUuvD7KFOu9x/Bd5YHyO0DIz2ls/Kl8g0ItS4X/ilEgf4T1Br0lgSg==
version "4.8.6"
resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.8.6.tgz#96406f3f5f0755d272e27a66f4163ca821590a7e"
integrity sha512-ZHao85gf0eZ0ESxLfCp73GG9O/VTytYDIkIiZDlURppLTI9wErSM/5yAKEq6rcUdxBLjMELmrYUJGg5sxGKMHg==
dependencies:
caniuse-lite "^1.0.30001022"
electron-to-chromium "^1.3.338"
node-releases "^1.1.46"
caniuse-lite "^1.0.30001023"
electron-to-chromium "^1.3.341"
node-releases "^1.1.47"
buffer-alloc-unsafe@^1.1.0:
version "1.1.0"
@ -716,7 +716,7 @@ camelcase@^5.0.0, camelcase@^5.3.1:
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320"
integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==
caniuse-lite@^1.0.30001020, caniuse-lite@^1.0.30001022:
caniuse-lite@^1.0.30001020, caniuse-lite@^1.0.30001023:
version "1.0.30001023"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001023.tgz#b82155827f3f5009077bdd2df3d8968bcbcc6fc4"
integrity sha512-C5TDMiYG11EOhVOA62W1p3UsJ2z4DsHtMBQtjzp3ZsUglcQn62WOUgW0y795c7A5uZ+GCEIvzkMatLIlAsbNTA==
@ -827,9 +827,9 @@ class-utils@^0.3.5:
static-extend "^0.1.1"
clean-css@^4.2.1, clean-css@^4.x:
version "4.2.2"
resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-4.2.2.tgz#8519abda724b3e759bc79d196369906925d81a3f"
integrity sha512-yKycArwReQXbOD/3pmsPmt6p7oUBww8MisDabL2pCUWkbVONvCJoBdCjgY4ZVQmKX5juz/JB9oDcP6XzGUpjwQ==
version "4.2.3"
resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-4.2.3.tgz#507b5de7d97b48ee53d84adb0160ff6216380f78"
integrity sha512-VcMWDN54ZN/DS+g58HYL5/n4Zrqe8vHJpGA8KdgUXFU4fuP/aHNw8eld9SyEIyabIMJX/0RaY/fplOo5hYLSFA==
dependencies:
source-map "~0.6.0"
@ -1236,9 +1236,9 @@ defaults@^1.0.3:
clone "^1.0.2"
defer-to-connect@^1.0.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/defer-to-connect/-/defer-to-connect-1.1.1.tgz#88ae694b93f67b81815a2c8c769aef6574ac8f2f"
integrity sha512-J7thop4u3mRTkYRQ+Vpfwy2G5Ehoy82I14+14W4YMDLKdWloI9gSzRbV30s/NckQGVJtPkWNcW4oMAUigTdqiQ==
version "1.1.3"
resolved "https://registry.yarnpkg.com/defer-to-connect/-/defer-to-connect-1.1.3.tgz#331ae050c08dcf789f8c83a7b81f0ed94f4ac591"
integrity sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==
define-properties@^1.1.2, define-properties@^1.1.3:
version "1.1.3"
@ -1406,10 +1406,10 @@ ee-first@1.1.1:
resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"
integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=
electron-to-chromium@^1.3.338:
version "1.3.340"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.340.tgz#5d4fe78e984d4211194cf5a52e08069543da146f"
integrity sha512-hRFBAglhcj5iVYH+o8QU0+XId1WGoc0VGowJB1cuJAt3exHGrivZvWeAO5BRgBZqwZtwxjm8a5MQeGoT/Su3ww==
electron-to-chromium@^1.3.341:
version "1.3.342"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.342.tgz#138317aa7399e268735b9269fe374a8566425090"
integrity sha512-An/MLhGLIG/g7lZ5vqs4lar96zv74agd3ZcADDHLpjAa16T7Y/pO/33Q31JOwpmHeyjithtHtUcn7XLuaz78lw==
emoji-regex@^7.0.1:
version "7.0.3"
@ -3605,7 +3605,7 @@ node-fetch@^2.3.0:
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd"
integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==
node-releases@^1.1.46:
node-releases@^1.1.47:
version "1.1.47"
resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.47.tgz#c59ef739a1fd7ecbd9f0b7cf5b7871e8a8b591e4"
integrity sha512-k4xjVPx5FpwBUj0Gw7uvFOTF4Ep8Hok1I6qjwL3pLfwe7Y0REQSAqOwwv9TWBCUtMHxcXfY4PgRLRozcChvTcA==