Opened 6 months ago
WP_Scripts: output script element only if src not empty
|Reported by:||niallkennedy||Owned by:|
I'd like to be able to asynchronously load an enqueued script without needing to completely rework WP_Scripts. I'd like to take advantage of common handles indicating a script is set to be loaded, extra data attached to a handle, and other WordPress script expectations while swapping out the <script src=""> echoed markup.
Why async? A script steps out of the way, offering progressive enhancement of the page or loading non-critical features such as stats or socal network sharing buttons. Async loading also helps prevent single points of failure in webpage loading caused by China blocking Facebook or resources hosted at Amazon Web Services going offline for a few hours.