Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dxw/govpress-blocks
Reusable blocks for WordPress
https://github.com/dxw/govpress-blocks
composer govpress packagist php
Last synced: about 4 hours ago
JSON representation
Reusable blocks for WordPress
- Host: GitHub
- URL: https://github.com/dxw/govpress-blocks
- Owner: dxw
- License: mit
- Created: 2022-07-27T14:35:42.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-09-25T17:18:19.000Z (over 2 years ago)
- Last Synced: 2024-12-12T22:09:51.238Z (about 2 months ago)
- Topics: composer, govpress, packagist, php
- Language: PHP
- Homepage:
- Size: 17.6 KB
- Stars: 2
- Watchers: 10
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# GovPress Blocks
A library of reusable blocks for use in GovPress projects.
## How to use
1. Install the package in your theme:
```
composer require dxw/govpress-blocks
```
1. Use the factory to create the blocks you want to use, and pass them any configuration, e.g.
To create a card block with default config:
```
\Dxw\GovPressBlocks\Factory::create('card');
```
To create a card block that renders a custom template:
```
\Dxw\GovPressBlocks\Factory::create('card', [
'template' => '\the\full\path\to\your\custom\template.php`
]);
```
For dxw projects, the recommended approach is to add this code to your theme's `app/di.php`, if the theme uses [Iguana](https://github.com/dxw/iguana).
1. If you want to use the default styles for a block, import them into your main SASS file like so (where the final name in the path is the block type):
```
@import 'vendor/dxw/govpress-blocks/assets/scss/blocks/card'
```The available blocks are documented below.
## Blocks
### Card
`\Dxw\GovPressBLocks\Factory::create('card', array $config)`
Config options:
```
[
'template' => string $theFullPathToYourCustomCardTemplate
]
```Sass:
```
@import 'vendor/dxw/govpress-blocks/assets/scss/blocks/card'
```