@beyonk/google-fonts-webpack-plugin
@beyonk/google-fonts-webpack-plugin
npm i @beyonk/google-fonts-webpack-plugin
@beyonk/google-fonts-webpack-plugin

@beyonk/google-fonts-webpack-plugin

Google Fonts Webpack plugin

by beyonk-adventures

1.7.0 (see all)License:ISCTypeScript:Not Found
npm i @beyonk/google-fonts-webpack-plugin
Readme

Google Fonts Webpack Plugin

Compatible with Webpack >= 4.14.0 and >= 5.0.0

Download Google fonts to webpack build folder using google-webfonts-helper or use CDN to integrate with html-webpack-plugin.

publish


Install

npm install @beyonk/google-fonts-webpack-plugin

Usage

/webpack.config.js

const GoogleFontsPlugin = require("@beyonk/google-fonts-webpack-plugin")

module.exports = {
    "entry": "index.js",
    /* ... */
    plugins: [
        new GoogleFontsPlugin({
            fonts: [
                { family: "Source Sans Pro" },
                { family: "Roboto", variants: [ "400", "700italic" ], display: "block" }
            ]
            /* ...options */
        })
    ]
}

Options

new GoogleFontsPlugin(options: Object)
NameTypeDefaultDescription
fontsFontObject[]-Configuration generated by Fontello.com.
nameString"fonts"Module name.
filenameString"fonts.css"Css file name.
pathString"font/"Relative path to fonts directory. If path is undefined fonts are not downloaded, the css file is generated with Google hosted font files.
localBooleantrueWhether to use google-webfonts-helper API or just link to Google Fonts hosted css. If this option is set to false this plugin just adds the css url to html-webpack-plugin (if present).
noLocalInCssBooleanfalseWhether to prepend local(FontName) expression before font files in CSS file (see MDN).
formatsArray[ "eot", "woff", "woff2", "ttf", "svg" ]Font formats to download.
apiUrlString"https://google-webfonts-helper.herokuapp.com/api/fonts"google-webfonts-helper API url.

FontObject

NameTypeDefaultDescription
familyString-Font family.
variantsArray-Font variants according to google-webfonts-helper (e.g.: [ "italic", "500", "700italic" ]).
subsetsArray-Font subsets according to google-webfonts-helper (e.g.: [ "latin", "greek" ]).
formatsArray-Font formats to download. Defaults to options.formats.
displayString"swap"Font Display
No alternatives found
No tutorials found
Add a tutorial
No dependencies found

Rate & Review

100
No reviews found
Be the first to rate