astro-font will automatically optimize your Custom Fonts, Local Fonts, Fonts over any CDN and Google fonts for performance.
The project is inspired by the Next.js Font Optimization.
Installation
Google Fonts
Automatically optimize any Google Font. To use the font in all your pages, add it to head tag in an Astro layout:
Local Fonts
Using Multiple Fonts
You can import and use multiple fonts in your application. There are two approaches you can take.
Just extend the array of the config to contain the new collection of the fonts:
Testimonials
Thank you for that awesome package... it helped me fight the "layout shift"!
— Michael Rambeau (@michaelrambeau) January 17, 2024
I will add it to Best of JS, as we have a tag `Astro` https://t.co/38Akqa5IQd
References
- GitHub: astro-font
- Astro Starter: launchfa.st