- This topic has 7 replies, 3 voices, and was last updated 3 years, 7 months ago by
Ying.
-
AuthorPosts
-
February 15, 2022 at 9:47 am #2119888
Brendan
This is a feature request unless I’m missing a GP customizer setting.
Google pagespeed complains that font-icons.css is missing font-display:swap;. I have to manually add this to font-icons.min.css and font-icons.css after a theme update. Can this be added to these files in future updates?
It’s possible the .css isn’t shipped with font-diplay:swap; included because it might disrupt appearances.
Steps for those who want to fix the Pagespeed notification:
- Find these files in your GP theme folder:
/generatepress/assets/css/components/font-icons.css
/generatepress/assets/css/components/font-icons.min.css - font-icons.css – look for font-style:normal; following the @font-face at the very beginning of the file. Add “font-display:swap;” (without quotes) following font-style:normal;
- font-icons.min.css – as above, look for font-styl:normal following the @font-face. It won’t have a “;” because this file is minified. Add a “;” after “normal” immediately followed by “font-display:swap;” before the closing bracket }.
- Clear Autoptimize Cache if you use it.
- Custom Purge Cloudflare cache for these 2 files only, adjusting paths for any customized installations:
https://www.YOURDOMAIN.com/wp-content/themes/generatepress/assets/css/components/font-icons.min.css
https://www.YOURDOMAIN.com/wp-content/themes/generatepress/assets/css/components/font-icons.css
February 15, 2022 at 9:56 am #2119899David
StaffCustomer SupportHi there,
the issue with adding
display=swap
to an icon font is that the browser has no alternative system font to display. Which, as you rightly point out, could lead to issues with the icon being displayed.Our preferred solution is to switch the Customizer > General > Icon Type to SVG.
This eliminates the need to load any font as it adds the theme icons as inline SVGs.But thank you for sharing your method 🙂
February 15, 2022 at 10:03 am #2119909Brendan
Hi David,
Thanks so much for your reply! Will experiment with that customization.
February 15, 2022 at 10:09 am #2119914David
StaffCustomer SupportYou’re welcome!
February 15, 2022 at 10:24 am #2119927Brendan
Hi David,
Strange – I selected SVG and now two drop-down arrows appear next to each other in my desktop menu. On mobile, I get two hamburger menu icons.
Tried clearing cache, no luck.
Did I miss another setting somewhere?
February 15, 2022 at 10:28 am #2119932Ying
StaffCustomer SupportHi Brendan,
This sounds like a cache issue.
Can you disable your cache plugin and try to clear server cache and browser cache as well?
February 15, 2022 at 10:38 am #2119950Brendan
Hi Ying,
Thanks you’re correct. I missed a cache! For anyone else, clear these caches:
- Autoptimize if installed
- Cloudflare if active
- Autoptimize Critical CSS (the one I missed 🙂 )
CriticalCss will need to create new rules for the change to SVG anyway.
February 15, 2022 at 10:43 am #2119959Ying
StaffCustomer SupportGlad you figured it out 🙂
- Find these files in your GP theme folder:
-
AuthorPosts
- You must be logged in to reply to this topic.