-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Create Block: Update templates to use APIs introduced in WP 6.1 #44185
Conversation
1325666
to
8981340
Compare
Size Change: 0 B Total Size: 1.27 MB ℹ️ View Unchanged
|
8981340
to
6b8f53a
Compare
'editor_script' => '{{namespace}}-{{slug}}-block-editor', | ||
'editor_style' => '{{namespace}}-{{slug}}-block-editor', | ||
'style' => '{{namespace}}-{{slug}}-block', |
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.
For now, I had to leave it as is, but I hope we can figure out a way to move all JS and CSS registration to block.json
when someone opts out from using build tools. Tracked in #40447.
@@ -33,53 +33,6 @@ | |||
* @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/ | |||
*/ | |||
registerBlockType( '{{namespace}}/{{slug}}', { | |||
/** |
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.
The removed code is loading from block.json
now.
a9e3ae8
to
843960b
Compare
843960b
to
2fea1ad
Compare
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.
LGTM! Really excited to get this out in the world!
2fea1ad
to
c7be5ea
Compare
Included changes to the documentation with c7be5ea that reflect the most recent fix in WordPress core: https://core.trac.wordpress.org/changeset/54367. |
@ryanwelcher , could you please resolve the conflicts of this PR so we can land it? Thank you! |
@c4rl0sbr4v0 I've updated the PR. There is a change to a dependabot.yml file that I am not sure is supposed to be there though. Maybe I should revert that file? |
Thank you! |
Thank you for bringing it up to date. It should be good to land in a few days so it gets published to npm on Nov 2nd - one day after WP 6.1 is out. It feels like a perfect timing with Gutenberg releases 😃 |
What?
Now that we have support for
render
inblock.json
coming to WordPress 6.1, we can integrate that into@wordpress/create-block
to improve the developer experience.This PR will have to wait to land until we get closer to the WordPress 6.1 release date (November 1st).
How?
Add a new
render
field todefaultValues
in external templates to let folks define the path to the PHP file that's going to be used with dynamic blocks. I also updated all dynamic variants to use his newly introduced config option.Testing Instructions
The following should scaffold a dynamic block that works without the build step.
This is how you can test the version with the build step for the tutorial in Block Editor Handbook:
npx wp-create-block --no-wp-scripts --variant dynamic --template @wordpress/create-block-tutorial-template dynamic-example-tutorial cd dynamic-example-tutorial ../node_modules/.bin/wp-scripts build