@el7cosmos/gatsby-plugin-prefetch-google-fonts

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.


Keywords
gatsby-plugin, gatsby, plugin, web, font, loader, google, webfont, webfontloader, prefetch, download, downloader, local
License
MIT
Install
npm install @el7cosmos/gatsby-plugin-prefetch-google-fonts@2.0.3

Documentation

gatsby-plugin-prefetch-google-fonts

A Gatsby plugin to download and prefetch Google Fonts. Can increase performance as opposed to loading webfonts from Google's external stylesheet.

Installation

With npm:

npm install --save @el7cosmos/gatsby-plugin-prefetch-google-fonts

Or with Yarn:

yarn add @el7cosmos/gatsby-plugin-prefetch-google-fonts

Usage

In your gatsby-config.js file, load in the plugin along with which web fonts to load.

module.exports = {
  plugins: [
    {
      resolve: `@el7cosmos/gatsby-plugin-prefetch-google-fonts`,
      options: {
        fonts: [
          {
            family: 'Roboto',
            variants: [
              '400',
              '400i',
              '700',
              '700i',
            ],
            subsets: [
              'latin-ext',
            ],
          },
        ],
      },
    }
  ]
}

For a list of all available font family options, consult the google-fonts-plugin readme.