dxw / govpress-blocks
WordPress 重复使用的自定义模块
dev-main
2022-08-08 12:25 UTC
Requires
- php: ^7.4||^8.0
- stoutlogic/acf-builder: ^1.12
Requires (Dev)
- dxw/php-cs-fixer-config: ^2.0
- kahlan/kahlan: ^5.2
This package is auto-updated.
Last update: 2024-08-25 21:32:02 UTC
README
一个用于在 GovPress 项目中使用的可重复使用模块库。
如何使用
- 在您的主题中安装包
composer require dxw/govpress-blocks
- 使用工厂创建您想要使用的模块,并传递任何配置,例如:创建一个带有默认配置的卡片模块
创建一个渲染自定义模板的卡片模块\Dxw\GovPressBlocks\Factory::create('card');
对于 dxw 项目,建议将此代码添加到主题的\Dxw\GovPressBlocks\Factory::create('card', [ 'template' => '\the\full\path\to\your\custom\template.php` ]);
app/di.php
中,如果主题使用 Iguana。 - 如果您想使用模块的默认样式,请将其导入到主 SASS 文件中,如下所示(路径中的最终名称是模块类型)
@import 'vendor/dxw/govpress-blocks/assets/scss/blocks/card'
以下文档化了可用的模块。
模块
卡片
\Dxw\GovPressBLocks\Factory::create('card', array $config)
配置选项
[
'template' => string $theFullPathToYourCustomCardTemplate
]
SCSS
@import 'vendor/dxw/govpress-blocks/assets/scss/blocks/card'