Version 2.0 introduces a new and exciting way to organize and group your block markup and assets. This method is especially useful if you have dedicated stylesheets and script files for your blocks and wish to organize those in a single place.
Instead of a single file, create a folder with the block name and create a new file named index inside of it. (.php or .twig)
The block folder needs to reside in your blockstudio directory.
Blockstudio automatically registers every file named index as a folder component and will use the parent folder name as the block ID. Please note that this is purely an organizational choice, for example, it is still possible to do the following:
This would register blocks with the IDs of my-block, my-block-alternative and enqueue both CSS and JS files when the blocks are present.
Blockstudio automatically gives your blocks unique IDs depending on their prefix, file name and how deeply they are nested. Since no files can be named the same in a file system, no two block IDs will ever be the same.
However, with the introduction of folders, there is now a possibility of two blocks having the same ID. Let's imagine this theoretical setup inside a theme:
Both blocks would have the same my-block ID and thus won't be initialised. To prevent this, simply make sure that each block has a unique name within a folder.