Building Blocks Based on block.json Using @roots/bud Instead of @wordpress/scripts

I’m currently considering a transition from @wordpress/scripts to @roots/bud. My project presently involves a plugin with multiple blocks, and I’m looking to maintain the same structure during this transition, specifically the compilation based on block.json files. Here’s a example of my project’s structure:

src
│
├── block1
│   ├── block.json
│   └── index.ts
│
└── block2
    ├── block.json
    └── index.ts

I see that @roots/bud-preset-wordpress offers a function roots.register.blocks. I’m curious if anyone has experience or suggestions on how to make this function work with block.json files in a similar manner to how wp-scripts does? wp-scripts automatically identifies all directories within src that contain a block.json and compiles the blocks accordingly.

Any advice or guidance from those who have experience with this kind of transition, or insights about handling block.json files in @roots/bud, would be greatly appreciated!

3 Likes

I’d also love to know if this is possible and if one could register block-specific stylesheets for the editor and frontend like you can in block.json.