[wp-trac] [WordPress Trac] #60240: Modules API: Move the modules to the footer in classic themes
WordPress Trac
noreply at wordpress.org
Fri Jan 12 11:21:32 UTC 2024
#60240: Modules API: Move the modules to the footer in classic themes
---------------------------+-----------------------------
Reporter: luisherranz | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Script Loader | Version:
Severity: major | Keywords:
Focuses: javascript |
---------------------------+-----------------------------
In the ticket that introduced the Modules API (#56313), I added a logic
that prints as many enqueued and preloads as possible in the head, then
prints the remaining ones in the footer and includes the import map. I
explain my reasoning [https://github.com/WordPress/wordpress-
develop/pull/5818#discussion_r1446384970 in this comment].
But @cbravobernal realized that import maps fail if they appear after the
modules. That means that there's no other way but printing the import map
first, and then all the modules and preloads (yes, preloads also fail!).
So we need to check if we are on a classic or block theme, and if we are
in a classic theme, move everything to the footer.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/60240>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list