• I’m using a suffusion theme, which utilizes around 10 stylesheets and I’ve heard it’s better to combine them into one. So I’m asking what options do I have to combine them safely and without any bugs so that things will keep working in future as if nothing happened. Do I just paste all other css’s to the end of style.css?

Viewing 5 replies - 1 through 5 (of 5 total)
  • I cannot think of any reason why it would be better to have one stylesheet instead of several.

    Maybe someone can shed some light on this?

    Anyhow: the styles closest to your xhtml are leading in case of a conflict, so when you decide to put everything in one stylesheet, make sure it has the same order as it is in your current <head></head>.

    Peter

    Thread Starter maleficus

    (@maleficus)

    As far as I know having multiple css files requires more HTTP requests, thus taking the page longer to load.

    If you’re loading all those stylesheets on every page, then yes it’s better in 1 file..

    It really depends if any of those stylesheets only load under certain conditions or whether they’re loaded on EVERY page.

    Alternatively you could look at placing conditions round the stylesheet calls.

    Let’s say for example you have some custom comments CSS, that’s only used when you’re viewing a single entry (single.php / comments.php) … it would make no sense to have those styles loaded for every page, when you could load them as and when they’re needed..

    ie.

    <?php if(is_single || is_singular) { // include styles/stylesheet stuff here } ?>

    That way your custom comments styles (per example) would only be loaded as and when they are needed.

    If you’re loading all those stylesheets on every page, then yes it’s better in 1 file..

    I wonder… wouldn’t those stylesheets not be cached on your local drive? Furthermore, in a corporate environment, it’s more likely that small files get cached in a proxy server, while larger files wouldn’t (squid for instance has a default maximum cache size of 4Kb).

    You might want to consider the overhead of setting up tcp sessions for every request your browser has to do to the web server, however since http/1.1 persistent connections are default, saving the session setup overhead.

    OTOH: having one stylesheet keeps administration of it a bit easier, since you don’t have to search for the right file to make changes.

    I would go for one file (unless the stylesheet is used for different purposes – screen vs print) 🙂

    Peter

    Cat

    (@catscholz74)

    This plugin seems to do the trick:
    halmatferello.com/lab/wp-css/

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Combine multiple css stylesheets’ is closed to new replies.