1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-17 16:05:33 -04:00

refactor font preloading

This commit is contained in:
2022-07-18 17:27:49 -04:00
parent de604f2f04
commit a788f673e9
8 changed files with 59 additions and 87 deletions

View File

@@ -13,13 +13,9 @@ import comicNeueLatin700ItalicWoff2 from "@fontsource/comic-neue/files/comic-neu
export const name = {
regular: "Comic Neue",
};
export const preloadFonts = [
{
key: "comic-neue-700",
src: comicNeueLatin700NormalWoff2,
type: "font/woff2",
},
];
export const preloads = [];
export const family: AtRule.FontFace[] = [
{
fontFamily: name.regular,

View File

@@ -15,14 +15,15 @@ export const name = {
regular: "Inter",
variable: "Inter var",
};
// re-export hashed URL(s) of the most prominent file so we can preload it in head:
export const preloadFonts = [
// re-export hashed URL(s) of the most prominent files so we can preload them in `<head>` (see pages/_document.tsx):
export const preloads = [
{
key: "inter-var",
src: interLatinVarFullNormalWoff2,
href: interLatinVarFullNormalWoff2,
type: "font/woff2",
},
];
export const family: AtRule.FontFace[] = [
{
fontFamily: name.regular,

View File

@@ -22,14 +22,15 @@ export const name = {
regular: "Roboto Mono",
variable: "Roboto Mono var",
};
// re-export hashed URL(s) of the most prominent file so we can preload it in head:
export const preloadFonts = [
// re-export hashed URL(s) of the most prominent files so we can preload them in `<head>` (see pages/_document.tsx):
export const preloads = [
{
key: "roboto-mono-var",
src: robotoMonoLatinVarWghtOnlyNormalWoff2,
href: robotoMonoLatinVarWghtOnlyNormalWoff2,
type: "font/woff2",
},
];
export const family: AtRule.FontFace[] = [
{
fontFamily: name.regular,