Opened 17 years ago
Closed 17 years ago
#9242 closed enhancement (duplicate)
Auto-magically reduce the number of plugin/theme script and css files
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 2.7 |
| Component: | Optimization | Keywords: | needs-patch |
| Focuses: | Cc: |
Description
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)
Note: See
TracTickets for help on using
tickets.
This was apparently done with WP in 2.8. It now needs to be done for plugins and themes now.