bnomei / kirby3-fontselector
用于在 Kirby 3 中选择字体家族和字重的分区,具有两个同步字段
1.2.0
2024-05-02 12:33 UTC
Requires
README
Kirby 3 插件,用于通过两个同步字段选择字体家族和字体粗细
商业用途
支持开源!
此插件是免费的,但如果您将其用于商业项目,请考虑赞助我或进行捐赠。
如果我的工作帮助您赚到一些钱,那么我觉得我可能也应该得到一点回报,对吧?
友善分享,谢谢。
- Bruno
安装
- 解压缩 master.zip 为文件夹
site/plugins/kirby3-fontselector
或 git submodule add https://github.com/bnomei/kirby3-fontselector.git site/plugins/kirby3-fontselector
或composer require bnomei/kirby3-fontselector
截图
字体
使用配置值设置您想要使用的字体。您可以使用自定义 JSON 文件或返回 PHP 数组。
assets/fonts.json
{ "fonts": [ { "font": "Merriweather", "weight": [ 600, 700 ] }, { "font": "Montserrat", "weight": [ 300, 400, 500 ] } ] }
<?php return [ 'bnomei.fontselector.fonts' => function() { return Json::read(kirby()->roots()->assets() . '/fonts.json'); // return ['fonts' => [...]]; }, // other options ];
用法
将字段添加到您的页面蓝图。
site/blueprints/default.yml
fields: headlinefont: type: fontfamily default: Merriweather required: true # reload: true # optional reload on save headlineh1weight: type: fontweight watchField: headlinefont default: 700 required: true headlineh2weight: type: fontweight watchField: headlinefont default: 600 required: true copytextfont: type: fontfamily default: Montserrat required: true copytextweight: type: fontweight watchField: copytextfont default: 400 required: true
⚠️ 此插件默认有 1 分钟的缓存。
设置
免责声明
此插件“原样提供”,不提供任何保证。请自行承担使用风险,并在将其用于生产环境之前自行测试。如果您发现任何问题,请 创建新问题。
许可证
不建议在任何推广种族主义、性别歧视、恐同、动物虐待、暴力或其他任何形式仇恨言论的项目中使用此插件。