webfont
v12.5.0
Published
Generator of fonts from SVG icons; decompress WOFF/WOFF2 to embedded TTF/OTF (not TTF↔OTF transcoding)
Downloads
125,791
Readme
webfont
Generator of fonts from SVG icons; decompress WOFF/WOFF2 to embedded TTF/OTF (not TTF↔OTF transcoding).
Requires Node.js >= 24.14.0. Use at build time only — do not import from browser or React client bundles (#198).
Install
npm install --save-dev webfontAdd a CLI script (optional):
{
"scripts": {
"icons": "webfont 'src/icons/*.svg' -d dist/fonts -t css"
}
}Full setup (cosmiconfig, verification, first run): install.md · webfont.js.org/introduction/install
Usage
Use the named export (recommended for ESM and CommonJS):
import { webfont } from "webfont";
const result = await webfont({
files: "src/svg-icons/**/*.svg",
fontName: "my-font-name",
});CommonJS:
const { webfont } = require("webfont");import webfont from "webfont" works on 12.x+ (default export is the function). On older releases use the named import — see migration notes.
Pipelines
Each run uses one mode (inputs cannot be mixed):
- SVG icons (default) —
.svg→svg,ttf,eot,woff,woff2 - TTF encoding —
.ttf→woff,woff2, and optionalsvg/eot(auto-detected) - Webfont decompress —
.woff/.woff2(paths, globs, or URLs) →ttfand/orotfper file
Details and limits: webfont.js.org/introduction/getting-started · Features
Documentation (shipped with this package)
| Guide | File |
|-------|------|
| Install & CLI wiring | install.md |
| webfont() options & svgicons2svgfont | docs/configuration.md |
| CLI flags & exit codes | docs/cli.md |
| Font licensing & legal notices | NOTICE.md |
More documentation
- Site: webfont.js.org
- Repository: github.com/itgalaxy/webfont
- Troubleshooting: webfont.js.org/introduction/troubleshooting
- Migration: webfont.js.org/migrating/
- Issues: github.com/itgalaxy/webfont/issues
- Changelog: webfont.js.org/introduction/whats-new · GitHub
License
The webfont software is licensed under the MIT License. That license does not apply to fonts or icons you process with the tool — see NOTICE.md.
