Optimizing WP, combining plugin javascripts and css?

Recently launched a site on a dedicated server, unfortunately I’ve got a big bunch of http requests that slows the site down as soon as there’s traffic. I’ve got a grade D on Yslow.
I know of minifying css and javascript, and also of combining in order to get less http requests.

Problem is, most of them are from various plugins used on the site. Slideshow gallery, events-calendar, wp e-commerce, mtouch-quiz, contactform etc etc etc… and many of them are located in the head of the document, and will break plugins used on the site if moved around.

Is it somehow possible to combine plugin javascripts? Will I have to manually edit the plugins and point them to a manually combined javascript every time they call on some JS? Same goes for all the css files the plugins are requesting.
Anyone had a similar problem and found a solution?

@tykho:
you can try combining files for your issue.W3-total-cache allows you to do it for both CSS and JS, which even gives you the option to modify the files order for the output combined file and the ability to exclude some files if you still have dependency issues.

I do see a problem though.
With my particular setup, this combining plugin breaks and I figured I would manually combine, with the combine.php script of Rakaz.

Following the instructions, when setting up the script, I see 1 problem:

wordpress structure does not have only 1 folder for CSS

same for JS

given that every theme and plugin has its own set of files, within their own path.

Thus when looking at:$cssdir = dirname(__FILE__) . '/css';
to specify a CSS folder, I wonder if it would be syntaxly correct to change it to, for instance:$cssdir = dirname(__FILE__) . '/wp-content/themes/theme1/css,/wp-content/plugins/plugin1/css,wp-content/plugins/plugin2/css';(to specify various folders)

Same would go with the JS folder structure.

Is such a syntax valid in php?

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Optimizing WP, combining plugin javascripts and css?’ is closed to new replies.