Robert Granlund
asked on
How To Preload Fonts That are included @font-face within Theme CSS
*** This question is specifically about how to Preload Fonts that are included @font-face NOT how to optimize for page speed!!!
I have a site that is using the Atelier Theme. In the main.css it loads a custom font with @font-face in the CSS file. In Google Page speed I get a pretty big lag of 12000ms to load the font. How do I preload a font that uses @font-face. I have place the following in the head but it makes no difference.
<link rel="preload" as="font" href="<?php echo get_template_directory(); ?>/css/font/si-atelier.woff?-7oeevn" type="font/woff" crossorigin="anonymous">
<link rel="preload" as="font" href="<?php echo get_template_directory(); ?>/css/font/fa-brands-400.woff2" type="font/woff2" crossorigin="anonymous">
This is what Google Pagespedd reports:
Preload key requests 11.4 s
I have a site that is using the Atelier Theme. In the main.css it loads a custom font with @font-face in the CSS file. In Google Page speed I get a pretty big lag of 12000ms to load the font. How do I preload a font that uses @font-face. I have place the following in the head but it makes no difference.
<link rel="preload" as="font" href="<?php echo get_template_directory(); ?>/css/font/si-atelier.woff?-7oeevn" type="font/woff" crossorigin="anonymous">
<link rel="preload" as="font" href="<?php echo get_template_directory(); ?>/css/font/fa-brands-400.woff2" type="font/woff2" crossorigin="anonymous">
This is what Google Pagespedd reports:
Preload key requests 11.4 s
Consider using `<link rel=preload>` to prioritize fetching resources that are currently requested later in page load.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.