# webfont-subset

> Based on [fontmin](https://www.npmjs.com/package/fontmin)

Latest version **0.0.2** (published 2023-02-15) · 0 weekly downloads

## Install

```sh
npm install webfont-subset
pnpm add webfont-subset
yarn add webfont-subset
bun add webfont-subset
```

Provides the command `webfont-subset`.

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2023-02-15 |
| First published | 2023-02-06 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 11.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | terion.name |

## Links

- npm: https://www.npmjs.com/package/webfont-subset
- npm.io page: https://npm.io/package/webfont-subset

## Dependencies (4)

- [mkdirp](https://npm.io/package/mkdirp.md) ^2.1.3
- [fontmin](https://npm.io/package/fontmin.md) ^0.9.9
- [commander](https://npm.io/package/commander.md) ^10.0.0
- [html-to-text](https://npm.io/package/html-to-text.md) ^9.0.3

## Recent versions

- 0.0.2 (latest) — 2023-02-15
- 0.0.1 — 2023-02-06

## README

# Simple tool for converting and subsetting web fonts
Based on [fontmin](https://www.npmjs.com/package/fontmin)

## Adding to a project
```shell
yarn add webfont-subset
npx webfont-subset # for help
```
Commands:
```shell
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
```
```shell
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:
```shell
npx webfont-subset subset -s english -i ./src/fonts/* -o ./dist/fonts
```
To use programmatically:
```js
const {reduceText, reduceSubsets} = require('webfont-subset')
await reduceText(inputFonts, output, text, formats)
await reduceSubsets(inputFonts, output, subsets, formats)
```

# As a cli tool
```shell
npm i -g webfont-subset
webfont-subset subset -s english -i ./src/fonts/* -o ./dist/fonts
```

See available subsets in  `subsets.json`

---
_Source: https://npm.io/package/webfont-subset · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
