#Local font disable preloading

1 messages · Page 1 of 1 (latest)

opal cedar
#

I am using a local font in my css and astro automatically preloads it. Is it possible to turn this off because I don't use it immediately

dark mulchBOT
#

Hi @opal cedar. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Based on the knowledge sources provided, there isn't specific information about disabling automatic font preloading for local fonts in Astro. The documentation covers how to add local fonts and use Fontsource, but doesn't explicitly mention a configuration option to disable the automatic preloading of font files.

When using local fonts, the documentation shows how to add them:

@font-face {
  font-family: 'DistantGalaxy';
  src: url('/fonts/DistantGalaxy.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

The documentation does mention that for Fontsource fonts, you can optionally preload fonts that are essential for initial page display, but this is presented as an additional step rather than something you need to disable:

"To optimize your website's rendering times, you may want to preload fonts that are essential for the initial page display." Using custom fonts

If you're looking to have more control over how assets are loaded, you might want to explore the advanced CSS import options mentioned in the documentation, such as using ?url imports which give you manual control over how a CSS file is loaded, though this is noted as not recommended for most users.

For a more definitive answer about disabling automatic font preloading, you might need to check the latest Astro documentation or ask in the Astro community forums.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: