static-font
v1.1.4
Published
CLI tool to easily manage and self-host web fonts in your projects
Downloads
22
Maintainers
Readme
static-font
A CLI tool to easily manage and self-host web fonts in your projects. It handles font copying, generates optimized @font-face rules, and maintains proper licensing information.
For Users
Direct Usage
# Interactive mode
npx static-font
# Install specific fonts
npx static-font Luciole-Regular Other+FontThis will:
- Create a
public/assets/fontdirectory in your project - Copy the selected fonts
- Print ready-to-use
@font-faceCSS rules with license information
Features
- Interactive font selection
- Direct font specification via CLI arguments
- Optimized
@font-facerules - Full Unicode range for European languages (French, German, Italian, Spanish, etc.)
- Font-display optimization
- License information included in CSS comments
For Package Authors
If you want to ensure specific fonts are available in projects using your package in your package.json add:
{
"scripts": {
"postinstall": "npx static-font Luciole-Regular AccessibleDfA-VF"
},
}This puts the fonts in the correct directory (the end user's project), adapt it to the fonts you want, from the available fonts.
Available Fonts
Luciole-Regular.woff2- A typeface specifically designed for visually impaired peopleLuciole-Bold.woff2AccessibleDfA-VF.woff2- Basic Latin, Latin-1 Supplement, Latin Extended-A, Latin Extended-B
Contributing New Fonts
Via GitHub
- Fork the repository
- Add your font file to
assets/font/ - Add the corresponding license file to
assets/license/- License filename must match font filename (e.g.,
MyFont.woff2→MyFont.txt)
- License filename must match font filename (e.g.,
- Create a pull request
Important: When contributing fonts, you MUST:
- Include the font's license file
- Ensure you have the rights to distribute the font
- Use WOFF2 format for optimal web performance
Request a Font
If you need a specific font added to the package:
- Open an issue on GitHub
- Include:
- Font name
- Link to font
- Use case
- License information
Technical Details
- Supports WOFF2 fonts
- Generates optimized
@font-facerules - Includes Unicode ranges for broad language support
- Preserves and displays font licensing information
License
MIT (for the tool itself)
Individual fonts are subject to their own licenses, which are preserved in the CSS output.
Support
Open an issue on GitHub for:
- Bug reports
- Feature requests
- Font addition requests
- Usage questions
