-
Notifications
You must be signed in to change notification settings - Fork 797
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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 |
@@ -1017,6 +1017,11 @@ public static function get_extensions_preset_for_variation( $preset_extensions_m | |||
$preset_extensions = array_unique( array_merge( $preset_extensions, $production_extensions ) ); | |||
} | |||
|
|||
$single_extensions = isset( $preset_extensions_manifest->single ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Path to folder containing built assets and the copy of block.json
.
@@ -268,4 +301,53 @@ module.exports = [ | |||
} ), | |||
], | |||
}, | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Build assets (JS and CSS) for "single" blocks. It also copies the block.json
file.
@@ -39,7 +39,7 @@ class Blocks { | |||
* | |||
* @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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.json
metadata file when registering a block on the backend.block.json
.editor.js
and 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