[wp-trac] [WordPress Trac] #44229: Use CDNs where possible to serve external assets like jQuery

WordPress Trac noreply at wordpress.org
Fri May 25 15:34:14 UTC 2018


#44229: Use CDNs where possible to serve external assets like jQuery
-------------------------+-----------------------------
 Reporter:  jacklenox    |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  General      |    Version:
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 There has been a long history of WordPress developers switching out the
 packaged version of jQuery in favour of using one from a CDN, like the one
 from Google's Hosted Libraries. A particular win when doing this is it
 means that if the browser has already cached jQuery from a CDN like
 Google's, it doesn't bother downloading it again when loading a new
 website that requests it.

 Unnecessary HTTP requests resemble a waste of electricity and carry a
 carbon footprint. That each WordPress site includes its own copy of jQuery
 could be seen to represent a massive waste of energy. Mozilla's 2018
 Internet Health Report highlights the growing – and potentially
 unsustainable – energy demand of the Internet:
 https://internethealthreport.org/2018/the-internet-uses-more-electricity-
 than/

 Could we consider making a change to WordPress whereby its first port of
 call for jQuery (and other JS libraries) is at a centralised location?
 Either with someone like Google or perhaps hosted on w.org?

 As well as representing a vast potential energy saving, this would also
 make all WordPress sites a little bit quicker.

 We could still include the locally packaged copy of jQuery and use it as a
 fallback where necessary like so:

 `<script>if ( ! jQuery ) document.write('<script
 src=jquery.js></script>')</script>` (h/t @johnbillion)

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44229>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list