0.4.4 • Published 6 years ago

google-fonts-webpack-plugin v0.4.4

Weekly downloads
2,007
License
ISC
Repository
github
Last release
6 years ago

Google Fonts Webpack Plugin

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


Install

npm install google-fonts-webpack-plugin

Usage

/webpack.config.js

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

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

Options

new GoogleFontsPlugin(options: Object)
NameTypeDefaultDescription
fontsFontObject[]-Configuration generated by http://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.
localBooleantrueWether 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).
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.
0.4.4

6 years ago

0.4.3

7 years ago

0.4.2

7 years ago

0.4.1

7 years ago

0.4.0

7 years ago

0.3.2

7 years ago

0.3.1

7 years ago

0.3.0

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago