mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-07-03 17:46:39 -04:00
font preloading logic
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import { Html, Head, Main, NextScript } from "next/document";
|
||||
import ThemeScript from "../components/ThemeScript/ThemeScript";
|
||||
import { getCssText, preloadUrls } from "../lib/styles/stitches.config";
|
||||
import { getCssText, preloadFonts } from "../lib/styles/stitches.config";
|
||||
import * as config from "../lib/config";
|
||||
|
||||
// https://nextjs.org/docs/advanced-features/custom-document
|
||||
@ -12,13 +12,13 @@ const Document = () => {
|
||||
<ThemeScript />
|
||||
|
||||
{/* preload highest priority fonts defined in ../lib/styles/fonts/ */}
|
||||
{preloadUrls.map((relativeUrl, index) => (
|
||||
{preloadFonts.map((font) => (
|
||||
<link
|
||||
key={`font-${index}`}
|
||||
key={`font-${font.key}`}
|
||||
rel="preload"
|
||||
as="font"
|
||||
type="font/woff2"
|
||||
href={relativeUrl}
|
||||
type={font.type}
|
||||
href={font.src}
|
||||
crossOrigin="anonymous"
|
||||
/>
|
||||
))}
|
||||
|
Reference in New Issue
Block a user