Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- File structure:
- ```
- |-- radicati
- |-- dist
- |-- lib
- |-- acf_gutenberg_blocks
- | |-- simple-button
- | | |-- simple-button.css
- | | |-- simple-button.js
- | | |-- simple-button.php
- | | |-- simple-button.scss
- | | |-- simple-button.svg
- | |-- block_custom-styles.js
- | |-- block_custom-styles.php
- | |-- block_registration.php
- |-- filters
- |-- gutenberg_blacklist.js
- |-- gutenberg_blacklist.php
- |-- update_button_href.php
- ```
- For each block that you create in the `block_registration.php` file, you can enqueue styles and scripts that only load when the block is shown (front or backend). A gulp watch task compiles the scss files individually to css.
- You can also set up a custom icon for your block. You can either use a dashicons string, or an svg stored as a string. For my Button block, I'm storing the contents of the svg file as a string in the 'icon' property using `file_get_contents()`. (I found it easier to edit the svg when I could view the file in the browser, and then I decided to keep that functionality by importing the file contents.)
- Blocks can have alternate styles (added and removed in block-custom-styles.js) that are applied as classes around the block. Stylesheets then use those classes to display alternate styles.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement