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

Improve custom blocks registration #408

Open
pierre-dekode opened this issue Oct 14, 2022 · 1 comment
Open

Improve custom blocks registration #408

pierre-dekode opened this issue Oct 14, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@pierre-dekode
Copy link

Just an idea!

Core just landed (in 6.1) a copy:block-json Grunt task to:

Introduce a new Grunt task (copy:block-json) that scans and converts core block.json files to PHP arrays and stores them in a single blocks-json.php at build time.
Use the new blocks-json.php file in the register_block_type_from_metadata() function.
Assign the block registration data to a static variable (cache) so that it’s only loaded once per request.

My understanding from that comment is that it's not yet available for custom blocks — only for core blocks.

But maybe we could have a similar build task in project base to get the same performance boost and limit unnecessary file loading.

@pierre-dekode pierre-dekode added the enhancement New feature or request label Oct 14, 2022
@stian-overasen
Copy link
Member

This is really interesting @pierre-dekode. WP 6.7 introduces wp_register_block_metadata_collection() for bulk registering a collection of blocks from a manifest file. Let's implement this in T2 for WP 6.7+

Can you open a issue in T2 for this and close this issue seeing as there are no blocks in Project Base?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants