stereobooster / react-snap

👻 Zero-configuration framework-agnostic static prerendering for SPAs
MIT License
5.04k stars 391 forks source link

Add preloadFonts option to add `<link rel="preload">` tags for fonts #502

Open 0xR opened 3 years ago

0xR commented 3 years ago

Description

Added an option to preloadFonts so I can get rid of the lighthouse warning below: image

I also ensure that the preloadImages option will add preload tags to the document head instead of the body as describe here: https://web.dev/preload-critical-assets/

The userAgent can now be turned off as well to avoid the issue of Google Fonts serving only ttf fonts if it doesn't recognize the user agent.

Let me now if I can do anything to get it merged. I'm motivated to get rid of my lighthouse warnings.