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.

Built from https://develop.svn.wordpress.org/trunk@56556


git-svn-id: http://core.svn.wordpress.org/trunk@56068 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter
2023-09-12 00:06:19 +00:00
parent de170c0c2e
commit ceb151029c
12 changed files with 174 additions and 22 deletions

View File

@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.4-alpha-56555';
$wp_version = '6.4-alpha-56556';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.