Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/firstandthird/dandy-blocks
A collection of Gutenberg blocks built on top of ACF.
https://github.com/firstandthird/dandy-blocks
Last synced: 14 days ago
JSON representation
A collection of Gutenberg blocks built on top of ACF.
- Host: GitHub
- URL: https://github.com/firstandthird/dandy-blocks
- Owner: firstandthird
- Created: 2021-03-19T04:15:12.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-01-31T17:37:27.000Z (about 2 years ago)
- Last Synced: 2024-04-08T15:13:11.641Z (10 months ago)
- Language: PHP
- Size: 165 KB
- Stars: 0
- Watchers: 9
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Dandy Blocks
A collection of Gutenberg blocks built on top of ACF.## Registering a new block
### config.json
Blocks need to be added to the `config.json` file.
Inside of the `config.json` there is a `blocks` object. Object keys are the block slugs used for loading the template. The values of the object should match the options available to [acf_register_block_type](https://www.advancedcustomfields.com/resources/acf_register_block_type/).
The basic structure should look like:
```json
{
"blocks": {
"blockSlug": {
//... block options
}
}
}
```Some block options are automatically configured and some can be overridden. Look at the `acf_register_block_type` section of `dandy-blocks.php` to see how the block is setup in code.
### Templates
Place the block template in the `blocks//block.php` file. You may place css/js in the `blocks/` directory/
Templates should use default clientkit classnames when possible and included styles should expect to be processed by CK (meaning you can use color variables and the like).
### Styles & Javascript
No styles or javascript are loaded by default. It is up to the theme to import the styles and javascript. If you add styles or js to a block, make sure it gets imported to the root `styles.css` or `scripts.js`
Block styles should be prefixed with `dandy-block__` to make sure there's no conflicts with existing blocks WordPress might have or other plugins register.
### Theme Specific Blocks
Same format only you put a blocks.json in the theme root and follow the above.