[wp-trac] [WordPress Trac] #9242: Auto-magically reduce the number of assets

WordPress Trac wp-trac at lists.automattic.com
Fri Feb 27 17:08:00 GMT 2009


#9242: Auto-magically reduce the number of assets
-------------------------------+--------------------------------------------
 Reporter:  Denis-de-Bernardy  |       Owner:  anonymous
     Type:  enhancement        |      Status:  new      
 Priority:  normal             |   Milestone:  2.8      
Component:  Optimization       |     Version:  2.7      
 Severity:  normal             |    Keywords:           
-------------------------------+--------------------------------------------
 I'm running into a performance problem on a site that I've found to be
 mostly due to the number of assets used on it. As in, the number of js and
 css files that get included.

 Could it be possible to add one or more hooks somewhere in WP_Dependencies
 that would let a plugin author catch every static js or css file, so as to
 bundle each and everyone of them in a single js or css file?

 In other words, after calling do_action(wp_print_script), we'd do
 something like:

 {{{
 foreach depends
   if extension is js
   then
     add to bundles
     delete from queue

 bundle_id = md5(serialize(bundles))

 if !file_exists(wp-content/bundle_id.js)
 then
   foreach bundles
     str .= file_get_contents(bundle)
   file_put_contents(wp-content/bundle_id.js, str)

 enqueue wp-content/bundle_id.js

 and continue as we'd normally do
 (and the same thing for css files)
 }}}


 Better yet, could the above behavior be built into the WP core?

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/9242>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list