Skip to content
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

When using react-typography, replace Google Fonts CSS w/ css font-face declaration #77

Open
KyleAMathews opened this issue Sep 5, 2016 · 3 comments

Comments

@KyleAMathews
Copy link
Owner

This saves the extra request to Google Fonts to grab the CSS file which can significantly delay starting the download of the fonts.

Google Fonts doesn't recommend this as they want you to always be grabbing the latest versions of fonts but if you regularly rebuild your site then you'll generally be up-to-date.

This might be better actually as a Gatsby plugin. It'd be an HTML post-processor — it'd scan HTML for google font css strings and replace them with the font-face declarations.

@KyleAMathews
Copy link
Owner Author

cursor_and_webpagetest_test_details_-dulles___www_bricolage_io-_09_05_16_11_10_50

From this load — it looks like making this change would speed up loading custom fonts by ~2-300 milliseconds.

@KyleAMathews
Copy link
Owner Author

Another idea is to publish open source fonts (e.g. those on Google Fonts) to NPM along with font-face css and then you can just include the font-face css in your webpack project.

Looks like there's all the convertor code we need on NPM https://www.npmjs.com/package/fontmin

@KyleAMathews
Copy link
Owner Author

Including a subsetted version (e.g. a-z1-9) version could be cool too to inline in the head ecomfe/fontmin#10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant