mercator/wn-localfonts-plugin
Composer 安装命令:
composer require mercator/wn-localfonts-plugin
包简介
Localize Google, Bunny, and Fontshare fonts for WinterCMS
README 文档
README
LocalFonts is a professional CLI utility for WinterCMS that localizes fonts from Google Fonts, Bunny Fonts, and Fontshare. It surgically extracts font assets, generates a manifest.json for version tracking, and builds a fonts.less file for immediate integration with your theme.
Key Features
- Multi-Source Discovery: Automatically falls back from Google to Bunny to Fontshare.
- Regex Isolation: Critical logic is protected within the
BaseCommandto prevent syntax errors. - Smart Filtering: Automatically bypasses subset filters if the provider labels a block with the font name (common for Fontshare/Satoshi).
- Variable Font Support: Downloads both individual "Static" weights and modern "Variable" font files.
- Surgical Removal: Intelligent file cleanup that only deletes assets when no other variants reference them.
Installation
Via Composer
Add the repository to your root composer.json and install:
composer require mercator/wn-localfonts-plugin
Manual Installation
- Create:
plugins/mercator/localfonts - Place the plugin files in their respective folders.
- Register the commands:
php artisan plugin:refresh Mercator.LocalFonts
Configuration
Control font character sets via your root .env file.
| Setting | Environment Variable | Default | Description |
|---|---|---|---|
| Subsets | LOCALFONTS_SUBSETS |
latin |
Comma-separated list (e.g., latin,latin-ext). Set to empty to fetch all. |
Usage
1. Add a Font (localfonts:add)
Search and localize a font family.
# Add standard weight php artisan localfonts:add Satoshi # Add full family (All weights + Italics + Variable blocks) php artisan localfonts:add Satoshi --full
2. List Fonts (localfonts:list)
View managed fonts. You can filter by family to see specific variants.
# List all php artisan localfonts:list # Filter by family php artisan localfonts:list Satoshi
3. Remove Fonts (localfonts:remove)
Surgically clean up your font directory.
# Remove only the large Variable files to save space php artisan localfonts:remove Satoshi --variable # Remove only Static weights (keeping the Variable file) php artisan localfonts:remove Satoshi --static # Remove everything for a family without confirmation php artisan localfonts:remove Satoshi --force
Theme Integration
Include the generated fonts.less (default: assets/src/fonts/fonts.less) into your main theme file.
UIkit Variable Mapping
We recommend using a mixin to map the specific localized IDs:
@import "../src/fonts/fonts.less"; // Mixin for surgical weight control .font-variant(@family; @weight; @style: normal) { font-family: @family; font-weight: @weight; font-style: @style; } h1 { .font-variant('Satoshi', 700); }
Pro-Tip: Browser Auditing
If you aren't sure whether to keep the Static or Variable files, you can use the Chrome DevTools Coverage Tab to see exactly which font files are being utilized by your page.
- Open DevTools (
Cmd+Shift+PorCtrl+Shift+P). - Type "Coverage" and select Show Coverage.
- Click the Reload icon.
- If a 200kb Variable font is 90% "red" (unused), you should switch to the 20kb Static files using
localfonts:remove Satoshi --variable.
mercator/wn-localfonts-plugin 适用场景与选型建议
mercator/wn-localfonts-plugin 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 01 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「plugin」 「fonts」 「localization」 「winter」 「winter cms」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 mercator/wn-localfonts-plugin 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mercator/wn-localfonts-plugin 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 mercator/wn-localfonts-plugin 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
CakePHP 4.x AdminLTE Theme.
Package for convenient work with Laravel's localization features
Field for number with restricted count of digits and decimal places
Automatically preload fonts from the Sage mix manifest
Deepl Automated translations for Laravel lang files
Add a typography test page to your silverstripe website / application.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 34
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2026-01-06