DEV Community

Discussion on: Self-host Google Fonts in your next React project with Fontsource

Collapse
 
aqrojo profile image
aqrojo

I didn't know Fontsource before your article Dan, thanks for sharing. I have a question, which is the benefice to use this package instead download and manage the font locally?

When I want to have a font in my project, usually I have a folder called assets/fonts in my src folder who contains the font files and the workaround to import them is similar to the described in your post

What's the difference between this two methods?

Collapse
 
brds15 profile image
Bruno Rodrigues dos Santos • Edited

There is another advantage: its run offline, so, you can use it in a progressive web app :)

Collapse
 
danwalsh profile image
Dan Walsh

Exactly! 😊

Collapse
 
danwalsh profile image
Dan Walsh

Hey mate, glad you got something out of my post! ☺️

The main difference is that by using Fontsource, you are effectively treating your self-hosted fonts as package dependencies that can be version locked and updated as needed.

It also saves you from having to manage the font files themselves, and from having to maintain a directory structure for them.

For example: if you need an extra subset (weight 500 italic) then it’s just one import line away, as opposed to downloading the new subset, converting it with Transfonter, adding the converted files to your repo and then importing the font for use.