Skip to content

Inject google font tags into your page automatically with Vite

License

Notifications You must be signed in to change notification settings

any-design/vite-plugin-gfont

Repository files navigation

vite-plugin-gfont

This plugin can automatically inject google font tags into your HTML.

Usage

Step 1: Install the package.

npm install vite-plugin-gfont -D

Step 2: Import it to your vite configuration.

import gfont from 'vite-plugin-gfont';

export default defineConfig({
  plugins: [gfont({
    proxy: '', // use proxy for google font
    fonts: [
      {
        family: 'Roboto',
        styles: [
          400,
          {
            weight: 500,
            italic: true,
          },
        ]; // weight or {weight, italic}, optional.
      },
    ],
    display: 'swap', // https://developer.mozilla.org/en-US/docs/Web/API/FontFace/display
  })],
});

License

MIT

About

Inject google font tags into your page automatically with Vite

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published