Fonts Local Importer CLI
fli is a production-ready Node.js CLI tool for downloading Google Fonts locally and injecting the corresponding @font-face rules into a project CSS file. It is designed for GDPR-compliant font delivery, modern TypeScript architecture, and framework-aware static asset placement.
- Prompt-driven CLI wizard with polished UX using
@clack/prompts - Supports multiple font families in one run
- Supports
ttf,woff2,woff,eot, andsvg(OTF generation is intentionally skipped) - Fonts are stored in
public/fontsand served from/fonts/for supported frameworks - Automatically detects Vite, Next.js, and Nuxt.js from
package.json - Places font files in framework-specific static asset directories
- Injects generated
@font-facerules below the last@importin the target CSS file - Creates the target CSS file if it does not exist
- Bundled with
tsupfor a compact, distributable CLI
Install locally or run via npx from the project root:
npx fliAnswer the prompt sequence:
- Name of font you want to import (comma separated)
- Which formats?
ttf,woff2,woff,eot,svg, orfull(full excludesotf) - Which wrapper are you using? Detect automatically or manual selection
- CSS file path to inject into
The CLI will:
- detect your framework from
package.jsonwhen possible - download fonts from the Google Webfonts Helper API
- convert missing formats locally when the API does not provide them
- save fonts under the correct static directory for your framework
- inject
@font-facerules into the provided CSS file
- Next.js
- Nuxt.js
- Vite
This repository includes a GitHub Actions release workflow at .github/workflows/release.yml. It:
- runs
npm ciandnpm test - resolves the release tag from the workflow input or
package.jsonversion - creates and pushes a git tag when needed
- generates a GitHub release from
CHANGELOG.md - publishes
@dstn/flito npm whenNPM_TOKENis configured
NPM automation tokens expire after 90 days. If the workflow fails during npm whoami or npm publish, regenerate the token at https://www.npmjs.com/settings/tokens and update the NPM_TOKEN secret in GitHub repository settings.
src/- TypeScript source filesdist/- Bundled CLI outputtsup.config.ts- Build configurationpackage.json- CLI package manifest
MIT