All our blocks go into plugins. You can either have one block per plugin or one plugin that contains multiple blocks.
When deciding to add a block to an existing plugin or as a standalone plugin, consider if this plugin is supposed to be available and shared with other sites in the network with the exact same functionality or if it is an opt-in feature that may only be used on a few sites.
Please do not style your blocks with the provided scss files. Use TailwindCSS classes directly in your markup instead.
Creating a new block plugin
In your terminal, navigate to the wp-content/plugins directory and run the following command:
Static blocks:
or for dynamic blocks
Creating a new block in an existing plugin
When creating a block plugin for the first time the block files will be inside the src/ directory. When adding additional blocks, you should move these files into their own folder. Example:
move src/* to /src/my-first-block/
In your terminal, navigate to the src directory inside of your blocks plugin and run the following command:
This will create an additional folder in your src/ folder with the new block files. You then need to open your plugin .php file and make adjustments.
Before:
After: