-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Add viewScriptModule handling to block.json metadata #5860
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
Changes from all commits
6b1035a
ad91ee9
f94fe16
51f8671
0be4744
0f7283d
8e4f1a7
3e51c6f
fb36f1f
8df5bc0
da148ad
84d8498
9705feb
876a507
3712584
b9af0e9
29edd40
9ea7f4e
a960f65
1a1f4e3
00fbf39
9da386d
2d3a37f
2112074
fc338e6
a225da1
d2a5c71
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -470,6 +470,12 @@ public function render( $options = array() ) { | |
| } | ||
| } | ||
|
|
||
| if ( ! empty( $this->block_type->view_script_module_ids ) ) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was wondering whether it would fit better after all filters get applied like
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you mean that authors could change the block or module dependencies in the I don't have strong feelings on whether or not it should be moved after the render filters. I do know that changing the module graph is error prone and not something that should be done in most cases.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Extenders can add/remove/replace what is inside
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm happy to defer to your judgment. My instinct was to align with how scripts work but we do not strictly need to do if we can improve things.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we can check if differs after
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't have a strong opinion about this but from my experience trying to change
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you anticipate introducing any conditional loading for view script modules depending on the HTML rendered for the block? Let's say enqueueing only these registered modules for the block that has corresponding directives in the final HTML. That would be a more compelling reason to move the logic after block render filters. |
||
| foreach ( $this->block_type->view_script_module_ids as $view_script_module_id ) { | ||
| wp_enqueue_script_module( $view_script_module_id ); | ||
| } | ||
| } | ||
|
|
||
| if ( ( ! empty( $this->block_type->style_handles ) ) ) { | ||
| foreach ( $this->block_type->style_handles as $style_handle ) { | ||
| wp_enqueue_style( $style_handle ); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.