Skip to content

Commit

Permalink
fix: eliminate render-blocking google font
Browse files Browse the repository at this point in the history
Eliminate render-blocking Google font by loading the font asynchronously.
  • Loading branch information
satnaing committed Dec 19, 2023
1 parent c526157 commit 33b527c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
14 changes: 14 additions & 0 deletions src/layouts/Layout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,25 @@ const socialImageURL = new URL(
<!-- Google Font -->
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
rel="preload"
as="style"
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,400;0,500;0,600;0,700;1,400;1,600&display=swap"
/>
<link
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,400;0,500;0,600;0,700;1,400;1,600&display=swap"
rel="stylesheet"
media="print"
onload="this.media='all'"
/>

<noscript>
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,400;0,500;0,600;0,700;1,400;1,600&display=swap"
/>
</noscript>

<meta name="theme-color" content="" />

{
Expand Down
6 changes: 5 additions & 1 deletion tailwind.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ module.exports = {
transparent: "transparent",
},
fontFamily: {
mono: ["IBM Plex Mono", "monospace"],
mono: [
"IBM Plex Mono", "ui-monospace", "SFMono-Regular",
"Menlo", "Monaco", "Consolas", "Liberation Mono",
"Courier New", "monospace"
],
},

typography: {
Expand Down

0 comments on commit 33b527c

Please sign in to comment.