[wp-trac] [WordPress Trac] #59316: Incorporate script loading strategies in bundled themes

WordPress Trac noreply at wordpress.org
Tue Sep 12 00:04:30 UTC 2023


#59316: Incorporate script loading strategies in bundled themes
---------------------------+--------------------------------------
 Reporter:  westonruter    |       Owner:  westonruter
     Type:  enhancement    |      Status:  closed
 Priority:  normal         |   Milestone:  6.4
Component:  Bundled Theme  |     Version:  6.3
 Severity:  normal         |  Resolution:  fixed
 Keywords:  has-patch      |     Focuses:  javascript, performance
---------------------------+--------------------------------------
Changes (by westonruter):

 * status:  accepted => closed
 * resolution:   => fixed


Comment:

 In [changeset:"56556" 56556]:
 {{{
 #!CommitTicketReference repository="" revision="56556"
 Bundled Themes: Use `defer` loading strategy for theme scripts.

 * Add `defer` loading strategy for all frontend end-user theme scripts
 (excluding Customizer preview).
 * Move scripts to the `head` which relate to the initial page viewport to
 ensure they start loading earlier and execute sooner while still not
 blocking rendering.
 * Update Twenty Twenty's script loader (`TwentyTwenty_Script_Loader`) to
 support core's built-in script loading strategies (#12009), while also
 retaining backwards-compatibility for child themes that may set `async`
 and `defer` script data.
 * Update the main script loading strategy in Twenty Twenty from `async` to
 `defer` for better performance on repeat page views, since when an `async`
 script is cached it will block rendering.

 Props westonruter, flixos90, sabernhardt.
 Fixes #59316.
 }}}

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


More information about the wp-trac mailing list