Extensions: Build individual blocks#31294
Conversation
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. Once your PR is ready for review, check one last time that all required checks (other than "Required review") appearing at the bottom of this PR are passing or skipped. Jetpack plugin:
|
|
Are you an Automattician? You can now test your Pull Request on WordPress.com. On your sandbox, run to get started. More details: p9dueE-5Nn-p2 |
| $preset_extensions = array_unique( array_merge( $preset_extensions, $production_extensions ) ); | ||
| } | ||
|
|
||
| $single_extensions = isset( $preset_extensions_manifest->single ) |
There was a problem hiding this comment.
Make sure blocks defined in the single array of the manifest are loaded in the backend.
| */ | ||
| function register_block() { | ||
| $dir = dirname( JETPACK__PLUGIN_FILE ); | ||
| $json_dir = $dir . '/_inc/blocks/' . FEATURE_NAME; |
There was a problem hiding this comment.
Path to folder containing built assets and the copy of block.json.
| } ), | ||
| ], | ||
| }, | ||
| { |
There was a problem hiding this comment.
Build assets (JS and CSS) for "single" blocks. It also copies the block.json file.
| * @return WP_Block_Type|false The registered block type on success, or false on failure. | ||
| */ | ||
| public static function jetpack_register_block( $slug, $args = array() ) { | ||
| public static function jetpack_register_block( $slug, $args = array(), $metadata_dir = '' ) { |
There was a problem hiding this comment.
Directory holding the block.json metadata file.
Fixes 1200913650729635-as-1199344868865051
Proposed changes:
This PR enables the loading of individual blocks assets (as opposed to chunk of assets).
In more details:
block.jsonmetadata file when registering a block on the backend.block.json.editor.jsand adds it as a dependency to single blocks.Other information:
Jetpack product discussion
1200913650729635-as-1199344868865051
Does this pull request change what data or activity we track or use?
No.
Testing instructions:
TBD