Auto-magically reduce the number of plugin/theme script and css files
|Reported by:||Denis-de-Bernardy||Owned by:||anonymous|
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?
Change History (3)
- Keywords needs-patch added; dev-feedback removed
- Milestone changed from 2.8 to 2.9
- Summary changed from Auto-magically reduce the number of assets to Auto-magically reduce the number of plugin/theme script and css files