Create Block: Allow templates to pass custom block.json
keys
#44626
Labels
Developer Experience
Ideas about improving block and theme developer experience
Needs Dev
Ready for, and needs developer efforts
[Tool] Create Block
/packages/create-block
[Type] Enhancement
A suggestion for improvement.
What problem does this address?
It is currently difficult to create a custom Create Block Template for ACF Pro 6.0, because ACF requires there to be a custom key in the
block.json
, e.g.What is your proposed solution?
Allow the default values passed through to have an optional custom key. I'm not sure the extent of the updates that would needed to be done for Create Block, but imagine the entry point would be somewhere around here: https://github.com/WordPress/gutenberg/blob/trunk/packages/create-block/lib/templates.js#L44
Ultimately, I would love to be able to write a custom Create Block Template with something like this:
Note the
_acf
key. I'm prefixing because I'm not sure what type of nomenclature or nesting we would want to help Create Block Templates core parse through custom keys and objects and_
was the best I could come up with. I'm open to ideas and implementation.Then a user could scaffold out a custom ACF block with a custom Create Block Template ACF package and run something like:
npx @wordpress/create-block --template acf --variant dynamic --no-plugin --no-wp-scripts --category acf
The text was updated successfully, but these errors were encountered: