#How can I purge character fonts which don't appear on the page?

3 messages · Page 1 of 1 (latest)

thorny shell
#

For some languages such as Japanese and Chinese, font files are huge. Since I'm building static pages, I thought it would be possible to remove characters that are not used on that page. Is there any way to achieve this with Astro?

harsh schoonerBOT
#

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

#

Hmm, I don't know enough to give you a confident answer yet. The extracts provided do not contain specific information about purging unused characters from font files in Astro. However, Astro does provide mechanisms for optimizing CSS and JavaScript, which might indirectly help with font loading performance.

Astro builds your site for production deployment by minifying and combining your CSS into chunks. Each page on your site gets its own chunk, and additionally, CSS that is shared between multiple pages is further split off into their own chunks for reuse. You can configure the size at which stylesheets will be linked externally using the assetsInlineLimit vite build option. If you would rather all project styles remain external, you can configure the inlineStylesheets build option. You can also set this option to 'always' which will inline all stylesheets. source (https://docs.astro.build/en/guides/styling#bundle-control)

For more specific guidance on font optimization, I would recommend checking out the Astro Documentation (https://docs.astro.build) or asking in the Astro community on GitHub or Discord.

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