0.0.2 • Published 1 year ago

webfont-subset v0.0.2

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

Simple tool for converting and subsetting web fonts

Based on fontmin

Adding to a project

yarn add webfont-subset
npx webfont-subset # for help

Commands:

npx webfont-subset subset --help

Usage: webfont-subset subset [options]

Reduce fonts to specified subsets

Options:
  -i, --input <string...>   Source files, supports globing
  -o, --output <string>     Destination directory
  -f, --format <string...>  Additional output formats, besides ttf, available options: woff, woff2, eot, svg, css
  -s, --subset <string...>  Target subsets
  -h, --help                display help for command
npx webfont-subset text --help

Usage: webfont-subset text [options]

Reduce fonts to meet chars in text

Options:
  -i, --input <string...>   Source files, supports globing
  -o, --output string       Destination directory
  -f, --format <string...>  Additional output formats, besides ttf, available options: woff, woff2, eot, svg, css
  -t, --text string         Target text: use an argument or pipe in
  -h, --html                Treat input as html: will clear out tags and extract text
  --help                    display help for command

Example:

npx webfont-subset subset -s english -i ./src/fonts/* -o ./dist/fonts

To use programmatically:

const {reduceText, reduceSubsets} = require('webfont-subset')
await reduceText(inputFonts, output, text, formats)
await reduceSubsets(inputFonts, output, subsets, formats)

As a cli tool

npm i -g webfont-subset
webfont-subset subset -s english -i ./src/fonts/* -o ./dist/fonts

See available subsets in subsets.json

0.0.2

1 year ago

0.0.1

1 year ago