Skip to content
This repository has been archived by the owner on Sep 16, 2022. It is now read-only.

Commit

Permalink
feat: add "no-js" fallback (#108)
Browse files Browse the repository at this point in the history
* I know it's not common, but adds "no-js" fallback

From senpai [Harry Roberts](https://csswizardry.com/2020/05/the-fastest-google-fonts/#google-fonts-async-snippet):

> In the unlikely event that a visitor has intentionally disabled JavaScript, fall back to the original method. The good news is that, although this is a render-blocking request, it can still make use of the preconnect which makes it marginally faster than the default.

* feat: add "no-js" fallback

From senpai [Harry Roberts](https://csswizardry.com/2020/05/the-fastest-google-fonts/#google-fonts-async-snippet):

> In the unlikely event that a visitor has intentionally disabled JavaScript, fall back to the original method. The good news is that, although this is a render-blocking request, it can still make use of the preconnect which makes it marginally faster than the default.
  • Loading branch information
zomars authored and joe-bell committed Mar 15, 2021
1 parent ccf3356 commit 4f45eb2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ export const GoogleFonts: React.FC<IGoogleFontsProps> = ({ href }) => {
/>
<link rel="preload" as="style" href={href} />
<link href={href} rel="stylesheet" media={!hydrated ? "print" : "all"} />
<noscript>
<link href={href} rel="stylesheet" />
</noscript>
</Head>
);
};

0 comments on commit 4f45eb2

Please sign in to comment.