Reputation: 263
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 !
Upvotes: 1
Views: 276
Reputation: 1519
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.
Upvotes: 2