Skip to content

Commit ddf42e0

Browse files
committed
perf(fonts): self-host Geist Mono variable WOFF2, add @font-face + preload; remove render-blocking CDN CSS
1 parent 4276dad commit ddf42e0

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed
64.8 KB
Binary file not shown.

src/layouts/Base.astro

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@ const { title = 'Your Name', description = 'Personal site' } = Astro.props;
1111
<meta name="description" content={description} />
1212
<meta name="theme-color" content="#ffffff" />
1313

14-
<link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin />
15-
<link
16-
rel="stylesheet"
17-
href="https://cdn.jsdelivr.net/npm/@fontsource-variable/geist-mono/index.css"
18-
/>
14+
<link rel="preload" as="font" href="/fonts/geist/GeistMono[wght].woff2" type="font/woff2" crossorigin>
1915

2016
<link rel="icon" href="/favicon.svg" />
2117
<title>{title}</title>

src/styles/global.css

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
@font-face {
2+
font-family: "Geist Mono";
3+
src: url("/fonts/geist/GeistMono[wght].woff2") format("woff2-variations");
4+
font-weight: 100 900;
5+
font-style: normal;
6+
font-display: swap;
7+
}
8+
19
:root {
210
--bg: #fafafa;
311
--text: #111111;
@@ -7,7 +15,7 @@
715
--lh: 1.6;
816
--space: clamp(1rem, 2vw, 1.75rem);
917
--radius: 10px;
10-
--font: "Geist Mono Variable", "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
18+
--font: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
1119
}
1220

1321
@media (prefers-color-scheme: dark) {

0 commit comments

Comments
 (0)