0

I'm creating a theme where i want it to have different widgets and plugins. Each plugin would ideally have it's own css file. However, this approach is not so good because i can end up having multiple files included in my header.

Is there an approach where i can sort of cache all different css files in a single one upon the first user request and then just use that ?

4

Yes: put them all in a function, and then enqueue that function at the wp_enqueue_scripts hook. That way, you can define the CSS dynamically (e.g. based on Theme option settings), and let WordPress output it in the document head.

  • +1 That sounds interesting, but it would still load different css files right ? Is it possible to load a single one using that or an altered technique? – SpyrosP Jun 24 '11 at 18:51
  • No; it would just output multiple <script> calls in the document head. – Chip Bennett Jun 24 '11 at 20:11
1

W3 Total Cache is your friend. It has the ability to combine and concatenate js/css files out of the box. You'll have to do some manual configuration, but the pros outweigh the cons.

0

WP Minify does the job quite well too. Little easier to configure than W3TC and integrates nicely with WP Super Cache if you're already using it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.