Add multiple styles/scripts with dependencies, version, etc. in block.json and provide examples in documentation #53847
Labels
[Feature] Block API
API that allows to express the block paradigm.
[Type] Developer Documentation
Documentation for developers
What problem does this address?
I see on the Metadata in block.json page that its possible to add front end, editor and shared styles/scripts in
block.json
. I also see you can add multiple scripts for each one of these, even with a mix of file names and previously registered script handles. For example,"style": [ "file:./style.css", "example-shared-style" ]
. This is great as it eliminates the need to enqueue these withwp_enqueue_script
andwp_enqueue_style
in PHP.However, its not clear to me if you can add an array of dependencies, version, etc. for each script, or if you still have to use
wp_enqueue_script
/wp_enqueue_style
when that is needed. If not, it would be even better to add this option, as each script often have their own dependencies, version, etc. It would also be nice to see an example of how to do that.What is your proposed solution?
Add the option to add multiple styles/scripts with dependencies, version, etc. in block.json (if not already possible) and provide examples of how to do so on the Metadata in block.json page (or elsewhere).
The text was updated successfully, but these errors were encountered: