I’m developing a WordPress theme framework. I want organize CSS for each section into separate files for the following reasons.
Extra http requests => more load on the server.
This disadvantage can be taken care by combining all the CSS files before they are served to the user using plugins like wp-minify.
But, will this combining process out weigh the above advantages.
From http://headjs.com/ :
There is a common misbelief that a single combined script performs best. Wrong:
(i dont know if it means .css and .js or only .js)
Following @edelwater’s excellent answer, another side-effect of the ‘combine all’ mantra is the induction of unused selectors.
Whilst perhaps unnoticeable on modern desktops, there’s still an extra hit on rendering time. For example, Chrome audit advises their removal as part of improving performance.
Of course, loading every declaration on-demand is ridiculous (not to mention counter-intuitive). It’s down to common sense, plucking out considerable chunks that aren’t used for the majority of the site, and loading them in with
wp_enqueue_style() when they’re needed.
Update: Yes, of course there’ll be overhead if you’re combining your stylesheets on-demand (read: for every request). However, I believe plugins like WP Minify cache the output on first request, so there shouldn’t be a problem.
Thank you edelwater and TheDeadMedic for you answers.
I think I will use the WordPress file system to save the files to uploads directory.
I have to ask for ftp login on some wordpress installs, I think I can handle that without loosing the AJAX options page using page overlay like wordpress uploader.