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?
@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](http://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)
@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?!
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.
You must be logged in to reply to this topic.