This is an experimental starter repo for scaffolding native blocks quickly.
This is meant to be run standalone in a wordpress sandbox. @wp/env is included and bootstrap is pulled in from a cdn.
- Clone the repo and run
npm install - Run
npm env:startto fire up docker and spin up a WP sandbox. This might take awhile... - Run
npm run startornpm run devto start compiling blocks in the background as you work
To access your local wordpress install admin you can use the default "admin" / "password" login. This plugin will be activated by default.
Create block is packaged with the plugin. Simply run npm run add-block and a wizard will guide you and place the block files in a new folder under the src directory.
Ideally we can create a framework style setup that allows quick native block creation approaching the ease of ACF.
This will allow a prepackaged plugin with standalone block support where the manual process of creating custom fields and mapping them to blocks through the admin is eliminated.
For real world use you can fork this repo or just download as a zip.
Install in the mu-plugins folder and follow the "adding blocks" process to build up your block library.
Once development is complete you can use the plugin-zip functionality to package everything up.
It is also possible to package this functionality inside a theme with some slight modifications.
- Plop files for more structured block starter
- Plop wizard for innerblocks, supports, etc
- Explore more schema/typescript/autocomplete options - maybe console tool that ouputs code?
- More complex fields - multi image, focal point, color, etc