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

WordPress Trac noreply at wordpress.org
Tue Feb 15 08:56:28 UTC 2022


#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:  Script Loader  |     Version:
 Severity:  normal         |  Resolution:
 Keywords:  has-patch      |     Focuses:  performance
---------------------------+------------------------------

Comment (by gziolo):

 I saw a comment from @ocean90 and I like this proposal. I was about to
 write that we could consider magic code comments in JavaScript files that
 would allow the build tool to extract that extra information. However, the
 solution described by Dominik looks way much better.

 When using `file:editor1.js` format you still would need a build step that
 generates the dependencies and the version, but now you would be able to
 pass extra arguments when necessary or even override some of those
 automatically generated if really necessary.

 > Not in the example but passing a single object should probably be
 possible too

 I'm not sure if we really need it because you could make it as simple as:

 {{{
 "editorScript": [ {
     "path": "file:abc.js",
     "data": { "async": true }
 } ]
 }}}

 Anyway, it's the least important part here.

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


More information about the wp-trac mailing list