[wp-trac] [WordPress Trac] #48654: Consider a solution/endpoint to lazy-load scripts and styles

WordPress Trac noreply at wordpress.org
Tue Feb 4 02:47:06 UTC 2020


#48654: Consider a solution/endpoint to lazy-load scripts and styles
-------------------------------------------------+-------------------------
 Reporter:  youknowriad                          |       Owner:  (none)
     Type:  feature request                      |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
                                                 |  Review
Component:  REST API                             |     Version:  4.7
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch dev-feedback needs-unit-   |     Focuses:
  tests                                          |  javascript, rest-api
-------------------------------------------------+-------------------------

Comment (by azaozz):

 Been thinking that there "must be" a better way to do dependencies in
 modern JS than to try to reuse script-loader from PHP.

 If not, some form of dependency tracking as part of Gutenberg perhaps
 makes most sense? Lazy-loading (known) scripts from js seems pretty simple
 (assuming it's async and doesn't look into loading order).

 Scripts that are already loaded will be "tracked" in js, then having the
 API provide the URLs for particular handles so "missing" dependencies can
 be lazy-loaded seems like enough?

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


More information about the wp-trac mailing list