New setup of radicle. Running npm run dev
, custom blocks works as expected, including the included modal block. When I stop npm run dev, the blocks are suddenly not registered anymore. I tried running npm run build
but that also doesn’t work. Have I missed something?
Hi there,
I’m not able to reproduce this Have you made any other changes? This shouldn’t be necessary, but try
wp acorn optimize
?
Tried a fresh install again. Just copied one of my custom blocks from the other install, same issue with my custom block, but the modal block works. I registered my custom block separately from the modal block this time:
domReady(() => {
/**
* Register blocks
*/
registerBlockType(modalBlock.name, {
apiVersion: 3,
title: modalBlock.title,
category: modalBlock.category,
attributes: modalBlock.attributes,
edit: modalBlock.edit,
save: modalBlock.save,
});
registerBlockType(gridBlock.name, {
apiVersion: 3,
title: gridBlock.title,
category: gridBlock.category,
attributes: gridBlock.attributes,
edit: gridBlock.edit,
save: gridBlock.save,
});
});
Before I made an array of all blocks and ran registerBlockType in an array map:
[
modalBlock,
columnsBlock,
columnBlock,
gridBlock
].map(block => {
registerBlockType(block.name, {
apiVersion: 3,
title: block.title,
category: block.category,
attributes: block.attributes,
edit: block.edit,
save: block.save,
});
});
Which suggests something is wrong with the registration of the blocks. Not sure what would cause the blocks to work during npm run dev and not otherwise though. No errors in the console either.
I’m using Laravel Valet.
Are you using the new make:block
Acorn command? It should set you up with everything you need
I copied the modal block file and just replaced the block name. When I try wp acorn make:block test
I get:
Command "make:block" is not defined.
This is on the latest version of Radicle? Also check out the blocks documentation. You need to register them with PHP as well.
I did not have the latest version! Silly mistake!