[wp-trac] [WordPress Trac] #43384: wp_enqueue_script:require authors to document these in the read.me file or style.css for example

WordPress Trac noreply at wordpress.org
Thu Feb 22 12:42:56 UTC 2018


#43384: wp_enqueue_script:require authors to document these in the read.me file or
style.css for example
-------------------------------------------------+-------------------------
 Reporter:  design_dolphin                       |      Owner:
     Type:  feature request                      |     Status:  new
 Priority:  normal                               |  Milestone:  Awaiting
Component:  Administration                       |  Review
 Severity:  normal                               |    Version:  trunk
  Focuses:  javascript, template, performance,   |   Keywords:
  coding-standards                               |
-------------------------------------------------+-------------------------
 '''A. Problem description:'''
 Too often finding a script not to run on certain locations is too
 cumbersome. wp_enqueue_script becomes a hunt for where a script is coming
 from, and then how to dequeue (under which name for example) it can be a
 time costing adventure. Still some authors don't use the wp_enqueue_script
 but a different way of declaring. Getting into (de)registering a script as
 well, and when to choose which if you want to offload a script, it's time
 consuming. This adds to development cost and time.

 '''B. Real world example:'''
 Take LazyLoad, quite a number of plugin authors are using this now
 (including JetPack), and so one can have multiple LazyLoad scripts to
 dequeue. Add in caching on multiple levels, and it is quite the mess to
 clean up.

 '''C. Performance Influence '''
 I have some concerns about how many scripts/styles get loaded all over the
 place, as a basic design premise. Loading scripts and styles only where
 they are needed can result in significant benefits such as improved load
 times. This can be done manually, and there are some plugins working with
 and on this as well.

 '''D. Proposed solutions:'''
 1. Make it best practices/requirement to document scripts/styles enqueed
 in the plugin/theme read me file, or at the top of the style.css for
 example for css (where would JS go?)
 2. Check automatically plugins/themes hosted on wordpress.org whether they
 comply or not and refuse to publish until they do. With a transition
 period for existing plugins. (This doesn't solve plugins/themes hosted
 elsewhere)

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


More information about the wp-trac mailing list