[wp-trac] [WordPress Trac] #54018: Allow scripts registered via block.json to be enqueued in the footer

WordPress Trac noreply at wordpress.org
Thu Aug 26 17:57:05 UTC 2021


#54018: Allow scripts registered via block.json to be enqueued in the footer
-------------------------+-----------------------------
 Reporter:  jeremyfelt   |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  General      |    Version:
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 It should be possible to pass an extra argument to
 `register_block_script_handle()` via `register_block_type_from_metadata()`
 that registers a block's front-end script so that it is enqueued in the
 footer.

 OR It should be possible for this information to be provided in
 `block.json` with the `script` property.

 OR It should be possible to filter the `wp_register_script()` call in
 `register_block_script_handle()` so that `$footer = true` can be passed
 just in time based on the handle of the script being registered.

 I'm probably missing a possibility, and I'm not sure what approach would
 be best, but I would like to output front-end scripts for blocks at the
 end of the page.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54018>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list