[wp-trac] [WordPress Trac] #12009: Add support for HTML 5 "async" and "defer" attributes

WordPress Trac noreply at wordpress.org
Wed Mar 10 14:59:15 UTC 2021


#12009: Add support for HTML 5 "async" and "defer" attributes
---------------------------+-----------------------------
 Reporter:  Otto42         |       Owner:  azaozz
     Type:  enhancement    |      Status:  reopened
 Priority:  normal         |   Milestone:  Future Release
Component:  Script Loader  |     Version:  4.6
 Severity:  normal         |  Resolution:
 Keywords:                 |     Focuses:
---------------------------+-----------------------------

Comment (by lkraav):

 Was looking into current state of systemic solutions for this, until
 something lands in core.

 https://github.com/mindkomm/theme-lib-script-loader-tags#use-name-suffixes
 looks like a solid approach, repo last updated 2 months ago.

 > Append any of the following suffixes to the name of your script to
 automatically set the attribute:
 >    |async for an async attribute
 >    |defer for a defer attribute
 >    |nomodule for a nomodule attribute
 >    |module for type="module" attribute

 like

 {{{
 wp_enqueue_script( 'js-picturefill|async', get_theme_file_uri(
 'build/js/picturefill.js' ) );
 }}}

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


More information about the wp-trac mailing list