1

What do you think is the best for website performance ? Load a different css per page (minified of course), so there won't be any unused css rule in this file, or load the same big (minified too) css in every page of the site ? The question could seem obvious, but I am wondering about the browser cache... if the big css is loaded in the browser cache, it won't be reloaded in each page, no ? So, maybe it is better to have a lot of unused css rules, but one file which is not reloaded every time than multiple files that we have to load when you browse the website.

Thanks !

3
  • Correct me if I am wrong. Isnt CSS stored as Cache in the browser history. So once they go to one page its stored and even if the go to the next page its still there? Again i could be wrong. Commented Jan 28, 2014 at 0:55
  • Yes CSS files are cached on the client side if client side browser settings permit. Commented Jan 28, 2014 at 0:57
  • Another way to ask this question is it a good idea to @import singular files into one master.css file. Thats another question. Commented Jan 28, 2014 at 0:59

1 Answer 1

2

It is better to have one big minified css with all the rules, that way you are reducing the amount of connections the browser attempts to do to the server, as well as only one CSS gets cached for every request.

Actually this is what most minify tools do, they compress all of the files in only one CSS file for the whole application.

The other approach for performance is to use Content Delivery Networks (CDN) to load common CSS or JS from the internet.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.