Skip to content
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

Block Infrastructure: allow building blocks separately #17099

Closed
5 of 6 tasks
jeherve opened this issue Sep 8, 2020 · 3 comments
Closed
5 of 6 tasks

Block Infrastructure: allow building blocks separately #17099

jeherve opened this issue Sep 8, 2020 · 3 comments
Assignees
Labels
Epic Formerly "Primary Issue", or "Master Issue" [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack [Package] Blocks [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Pri] Normal [Status] Blocked / Hold [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it

Comments

@jeherve
Copy link
Member

jeherve commented Sep 8, 2020

Jetpack product discussion

  • pedMtX-RS-p2

Background

Jetpack blocks are currently tightly bound to one another:

  • The JavaScript on the editor's side is bundled into a single js bundle, in _inc/blocks.
  • The tools used to register, enqueue JavaScript, and manage blocks on the frontend all live in one class, Jetpack_Gutenberg.
  • Some blocks rely on other classes that ship with the Jetpack plugin: Jetpack_AMP_Support, Jetpack_Options, Jetpack, and for some blocks some classes created specifically for those blocks: Jetpack_Mapbox_Helper and Jetpack_Instagram_Gallery_Helper come to mind.
  • Some blocks rely on custom REST API endpoints, living under _inc/lib/core-api/wpcom-endpoints/.

Those blocks were also created before WordPress 5.8 and its new block registration process were introduced:
https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/

Ideally, we would want to switch to this new block registration process for a few reasons:

  • It would allow splitting some of those blocks into standalone plugins if necessary.
  • It allow splitting each block's dependencies, thus only loading what is necessary when only some blocks are available on a site.
  • It would surface the blocks in the plugin description in the WordPress.org plugin directory, thus helping site owners discover what blocks are at their disposal.

Obviously, switching from one big JavaScript bundle with all blocks and their dependencies to multiple files can have a negative impact on performance. This problem may be addressed with some changes in Gutenberg.

Async block loading in Gutenberg

There has been an effort in the Gutenberg project to change the way blocks are loaded, allowing third-party plugins to load multiple blocks without impacting the block editor performance. This project is tracked here:

Tasklist

Tasks

Preview Give feedback
  1. 7 of 7
    Blocks V2 [Focus] Blocks [Plugin] Jetpack [Status] In Progress [Type] Enhancement
    kraftbj monsieur-z
  2. 11 of 11
    Epic [Focus] Blocks [Plugin] Jetpack [Pri] Normal [Type] Enhancement
    monsieur-z
  3. [Block] Blogging Prompt [Block] Business Hours [Package] Blocks [Plugin] Jetpack
    monsieur-z
  4. DO NOT MERGE [Block] Business Hours [Plugin] Jetpack [Status] In Progress [Status] Stale
    monsieur-z
  5. Triaged [Focus] Blocks [Focus] Compatibility [Plugin] Jetpack [Pri] BLOCKER [Status] Priority Review Triggered [Type] Bug [Type] Janitorial
    monsieur-z

Requirements (old project)

Note
The requirements below were originally set for a first attempt at this project back in 2021. They do not apply anymore today.

In order to be able to ship some of those blocks as standalone blocks, without the need for the full Jetpack plugin, we'd need to make a few changes:


Past Jetpack Product discussions

  • p9dueE-1VR-p2
  • p9dueE-1BH-p2

Async communication

#jetpack-blocks-improvements
#gutenberg-async-loading-code-splitting

@jeherve jeherve added [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it Epic Formerly "Primary Issue", or "Master Issue" [Pri] Normal [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack Build labels Sep 8, 2020
@jeherve jeherve self-assigned this Sep 8, 2020
@kbrown9
Copy link
Member

kbrown9 commented Dec 7, 2020

Update textdomains for standalone blocks, maybe as a post-install composer script, part of the jetpack-blocks package.

I opened a proposal PR #18003 for using the wp-textdomain npm package to change composer package strings. I wonder if that would also be useful for the blocks work. Let me know if you have any comments on that approach!

@jeherve jeherve moved this from To triage to To do in Jetpack Blocks [Archived] Aug 7, 2023
@jeherve jeherve assigned andrii-lysenko and monsieur-z and unassigned jeherve Aug 10, 2023
@jeherve jeherve moved this from To do to In Progress in Jetpack Blocks [Archived] Aug 10, 2023
@jeherve jeherve added [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Status] In Progress and removed Build labels Aug 10, 2023
@jeherve jeherve changed the title Blocks: allow building blocks separately Block Infrastructure: allow building blocks separately Aug 10, 2023
@kraftbj
Copy link
Contributor

kraftbj commented Aug 16, 2023

Once the individual block.json files are present and able to provide visibility, we'll put this project on hold while Gutenberg works on the async asset loading solution.

@kraftbj
Copy link
Contributor

kraftbj commented Sep 19, 2024

I'm going to close this issue since we've done as much as we can until async block loading is present.

@kraftbj kraftbj closed this as completed Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Epic Formerly "Primary Issue", or "Master Issue" [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack [Package] Blocks [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Pri] Normal [Status] Blocked / Hold [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it
Projects
No open projects
Status: Blocked/On Hold
Development

No branches or pull requests

6 participants