[Create Block] Add the capability of defining a function from a template to modify values passed to create the block #55421
Labels
Developer Experience
Ideas about improving block and theme developer experience
[Package] Create Block
/packages/create-block
[Status] In Progress
Tracking issues with work in progress
[Type] Enhancement
A suggestion for improvement.
[Type] Feature
New feature to highlight in changelogs.
What problem does this address?
Currently it's not possible to modify any of the values passed to create-block either from the CLI or a custom template. This means that any new functionality must be added via a flag and that there is no way to customize a large portion of these values in a template. For example,
textdomain
is always the slug value that is passed and is not changeable.What is your proposed solution?
I would like to introduce a transformer property that can be defined in an external template. This property would expect a function that receives all of the values that will be used to generate the files. This feature would provide complete control over the values being output and allow for conditional values based on others.
Example
In this example, we can generate a unqiue id that is prepended to the passed
slug
but then also usable for other properties.The text was updated successfully, but these errors were encountered: