-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Easy self-hosting of fonts #448
Comments
Might be easiest to push typefaces to NPM and then just install them from there... hmm... |
What's the current recommended way about this? |
Gatsby's webpack config is already setup so you can import font files. If you're looking to self-host open source files, you might be interested in my side-project Typefaces (which is actually where the ideas in this issue ended up... I'd forgotten about this issue :-)) https://github.com/kyleamathews/typefaces So yes, use Typefaces :-) Just npm install a font and then import it and you're good to go. That's what both Gatsbygram and gatsbyjs.org are doing. |
That is what I did - https://github.com/FeedbyDesign/wanna-play/blob/fonts/src/layouts/default.js#L3 |
Hmmm that's all you should have to do... if you look at your network tab, is there woff2 files being loaded? Also look in your |
I got it working in prod. Thanks.
Any idea where to look to correct that? |
Try changing the address in your browser from |
Sorry. Forgot to answer earlier but it works indeed. Pointing there for reference: #864 A rough idea about fonts: being able to import 'typeface-blah' (or a helper method) in utils/typography.js so that the needed css is processed with typography.js.
|
Hmmm... no? Typefaces relies on its css being processed by webpack. When that happens, webpack copies the font files into |
ok I clearly have a foggy point of view but I still think I may have a point so I'll try and make it. But again, I clearly don't see the full picture here so feel free to throw this idea under the bus if it does not make sense. |
@MarcCoet you could try the workaround from #561 |
Hosting your own fonts is much faster than using Google Fonts or Typekit, etc.
But it's kind of a pain to setup.
Which it shouldn't be, at least not for free fonts.
Solution: build Gatsby plugin which downloads desired fonts from https://github.com/majodev/google-webfonts-helper
Should have easy integration with Typography.js.
Lots of good ideas here: https://www.zachleat.com/web/comprehensive-webfonts/
The text was updated successfully, but these errors were encountered: