The Fontsource CLI allows users to build fontsource packages locally as well as create new packages for submissions. For metadata, it uses Google Font Metadata.
npm install @fontsource-utils/cli google-font-metadata
Builds a new fontsource package from a template for submission.
npx fontsource create
Verifies that a fontsource package is valid and ready for submission.
npx fontsource create-verify [options]
Option | Description | Default |
---|---|---|
-i, --id |
Directory to verify package e.g. ./[id]
|
Prompts user instead |
--ci |
Disables fancy prompts | false |
--cwd |
Sets the current working directory | process.cwd() |
Fetches the latest metadata from Google Fonts.
npx fontsource fetch [key] [options]
- Key is the Google Fonts API key. If not provided, it will be read from the environment variable
GOOGLE_API_KEY
.
Option | Description | Default |
---|---|---|
-f, --force |
Force parse all metadata without cache | false |
Builds all Google Fonts packages from the metadata generated from fontsource fetch
.
npx fontsource build [...fonts] [options]
- Fonts is a list of font ids to build. If not provided, it will build all fonts.
Option | Description | Default |
---|---|---|
-f, --force |
Force rebuild all packages from scratch | false |
-t, --test |
Generate a small number of packages for testing | false |
--ttf |
Download TTF/OTF font files | false |
MIT