With this script you may create how many wordpress gutenberg blocks you want without duplicate node modules
- Set the development env: https://developer.wordpress.org/block-editor/getting-started/devenv/
- Clone this repo in your plugin or theme
- From the main folder of this repo, run the command
npm install
- Include the file BlockGenerator.php (include, require, require_once) in your function.php or similar
- From the main folder of this repo, run the command
npm run create-block {block_name}
- The script will create a folder "blocks". You can find all the files of the new block inside that directory
- Move to ../blocks/{block_name} folder
- Run the command
npm run build
ORnpm run start
- From the main folder of this repo, run
npm run build-all
(alpha) -- Force the build for every blocks. Usefully if you use custom react components across the blocks.