A Gatsby plugin to download and prefetch [Google Fonts](https://fonts.google.com/). Can increase performance as opposed to loading webfonts from Google's external stylesheet.
npm install gatsby-plugin-prefetch-google-fontsA Gatsby plugin to download and prefetch Google Fonts. Can increase performance as opposed to loading webfonts from Google's external stylesheet.
With npm:
``bash`
npm install --save gatsby-plugin-prefetch-google-fonts
Or with Yarn:
`bash`
yarn add gatsby-plugin-prefetch-google-fonts
In your gatsby-config.js file, load in the plugin along with which web fonts to load.
`javascriptgatsby-plugin-prefetch-google-fonts
module.exports = {
plugins: [
{
resolve: ,Oswald
options: {
fonts: [
{
family: ,latin
subsets: [],Open Sans
},
{
family: ,400
variants: [, 700]``
},
],
},
}
]
}
For a list of all available font family options, consult the google-fonts-plugin readme.