Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Faster CSS!

  • This topic is empty.
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #41806

    i have a wordpress site with a lot of pages. i have just one style.css file. so i think this could be time consuming for loading every page because everypage has to load styles of all pages that doesn’t need! .so can i have a separate css file for every separate page? i mean a file with style of header and footer and other files for styling page contents. is this useful for speed?
    if it is useful how can i do this?

    #120090

    any help?!

    #120091
    Bonzai
    Participant

    It’s better to have all your styles in one CSS, the more css files you have, the more HTTP requests your site has to make. The same goes for your javascript files. Here’s a great video by Chris to help with improving site performance: [https://css-tricks.com/video-screencasts/114-lets-do-simple-stuff-to-make-our-websites-faster/](https://css-tricks.com/video-screencasts/114-lets-do-simple-stuff-to-make-our-websites-faster/ “”)

    #120094

    thanks a lot @Bonzai . that was what i wanted to know.

    #120105
    ooredroxoo
    Member

    @mostafaghanbari, its depends, if you have a big css for another section (another page) of the site maybe you should put on a separated file, if the user ever hits that section that stylesheet is loaded, but if not they don’t need to load.

    If isn’t so big just shove all on the same CSS.

    Besides that try to use caching as viewed on Screencast [#114: Let’s Do Simple Stuff to Make Our Websites Faster](https://css-tricks.com/video-screencasts/114-lets-do-simple-stuff-to-make-our-websites-faster/) quoted from @Bonzai and if needed [Requirejs.org – WHAT ABOUT LOADING CSS?](http://requirejs.org/docs/faq-advanced.html#css)

    #120111

    @ChrisP great article but no CodeKit in windows :(

    #120113

    @jurotek, very useful. i never heard of that! thanks

    #120114

    @ooredroxoo, i’m designing a forum for myself and trying to separate all things from together. because of this it doesn’t matter the css is big or not, it **must** be separate! but i have a problem. the only way i know is using tag but its in header section of wordpress site. how can i say if for example “contact page” in active, bring “contactpage.css” file?!

    #120140
    ooredroxoo
    Member

    I mean the size based on the requests, if somewhere on the road you end up with too much css loading on a single page, and they are not so big you can merge them to avoid some http connections on your site, and avoid repeating styles between pages.

    By separate the CSS I mean that you will end up with two o more files, and need reference them by link.

    The requirejs can be helpful to load dynamic after the initial load on the page, say you use ajax, you can then require the css for that section.

    #120236

    yes as you said the answer is requestJS! but i think for avoiding multiple server requests its better to have all things in one place. thanks any way @ooredroxoo.

Viewing 10 posts - 1 through 10 (of 10 total)
  • The forum ‘CSS’ is closed to new topics and replies.