I am using Google Fonts in my project and it works fine when I use the Link method. However, the fonts don’t render if I am offline. How do I include the downloaded Google Fonts in my Meteor-React project so that they work offline as well? I searched for the answer but was not able to locate it.
Trying this now, but can’t navigate to my packages directory. I can
cd .meteor
Kenneths-MacBook-Pro:.meteor PTKen$
but I cannot get the packages directory:
Kenneths-MacBook-Pro:.meteor PTKen$ ls
local packages platforms release versions
Kenneths-MacBook-Pro:.meteor PTKen$ cd packages
-bash: cd: packages: Not a directory
Oh, I see. Thanks @peterm. So what did @awatson1978 mean when she said [quote=“awatson1978, post:3, topic:16702”]
Just ‘git clone’ it into your packages directory,
[/quote]
Okay, I will try this. But that doesn’t answer the original question about how do I add Google Fonts to my project so that they work offline. I have downloaded the Fonts that I want to use, but where do I put them and how do I include them in the project?
I have created a directory “packages” in my project folder and included the google fonts. I followed the clinical fonts as a guide to create the css and package.js files. It works well enough that the app will launch now but I get an error in the console that the downloaded fonts could not be decoded. I didn’t understand everything in the css and package.js files, but I will comb through them again and if I still cannot make it work I will post my code.
Okay, I’m making progress, but I can’t seem to make it work. This article from The Meteor Chef really helped me fill in the gaps, but I apparently still have some gaps left. I’m hoping the community can help…
I have created a “packages” directory and assigned it to an environment variable. Typing env confirms it’s correct:
I have not been able to make this work yet. I decided to push it lower on my priority list so that I can just move forward for now. If you figure it out, please post here.
Download the fonts, put it in public/fonts then reference it in your css with @font-face if you need offline support. Otherwise just @font-face it with the google fonts link.
A year later it seems, that you still have to do this.
Having to copy stuff from node_modules to the public folder is disgraceful. And it really becomes a problem when it’s not your own code that uses the font but if it’s from within components you got via npm. Then you not only have to copy some font but need to deal with the component and it’s dependencies.
This is not a minor inconvenience.
This really has to get fixed ASAP.