Skip to content

Commit 67923b3

Browse files
committed
perf: move Google Fonts from CSS @import to HTML link tags
Replace render-blocking CSS @import statements with HTML link tags: - Material Icons loaded normally with display=swap for icon FOUT prevention - VT323 (used only in origin story modal) uses media="print" swap technique for truly non-blocking loading - Add noscript fallback for VT323 This eliminates the render-blocking behavior of CSS @import and allows fonts to load in parallel with other resources.
1 parent 9ed3184 commit 67923b3

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

index.html

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,24 @@
2323
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
2424
<link rel="preconnect" href="https://bugzilla.mozilla.org" />
2525

26+
<!-- Google Fonts - loaded as link tags to avoid render-blocking CSS @import -->
27+
<link
28+
rel="stylesheet"
29+
href="https://fonts.googleapis.com/icon?family=Material+Icons&display=swap"
30+
/>
31+
<link
32+
rel="stylesheet"
33+
href="https://fonts.googleapis.com/css2?family=VT323&display=swap"
34+
media="print"
35+
onload="this.media='all'"
36+
/>
37+
<noscript>
38+
<link
39+
rel="stylesheet"
40+
href="https://fonts.googleapis.com/css2?family=VT323&display=swap"
41+
/>
42+
</noscript>
43+
2644
<!-- Favicons -->
2745
<link rel="icon" type="image/png" href="/favicon.png" />
2846
<link rel="icon" type="image/x-icon" href="/favicon.ico" />

src/index.css

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
/* Load Google Material Icons */
2-
@import url('https://fonts.googleapis.com/icon?family=Material+Icons');
3-
4-
/* Load VT323 retro font for origin story */
5-
@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');
1+
/* Google Fonts are loaded via link tags in index.html to avoid render-blocking */
62

73
@tailwind base;
84
@tailwind components;

0 commit comments

Comments
 (0)