kirby3 fontselector
v1.2.0
フォントファミリを選択し、2つの同期フィールドでフォント重量を選択するKirbyプラグイン
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アレイを返すことができます。
資産/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
];ページの青写真にフィールドを追加します。
サイト/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分間のキャッシュがあります。
| bnomei.fontselector。 | デフォルト | 説明 |
|---|---|---|
| フォント | function(){...} | フォントアレイを返すコールバック |
| 期限切れ | 1 | キャッシュはn分間の有効期限が切れます |
このプラグインは、保証なしで「現状のまま」提供されます。自分の責任で使用し、生産環境で使用する前に常に自分でテストしてください。問題が見つかった場合は、新しい問題を作成してください。
mit
人種差別、性差別、同性愛嫌悪、動物虐待、暴力、またはその他のヘイトスピーチを促進するプロジェクトでこのプラグインを使用することは落胆しています。