suneet
suneet

Reputation: 400

Multiple CSS files vs combined file

So everyone knows the pros of having a single CSS file for a webpage.

But I think there's a great pro of having multiple CSS files

So If I have 500KB of code of CSS and internet speed of 50KBps (yes, i live in a poor country :-/ )...

method A will take (10+x)secs     # where x is the time for HTTP request
method B should take (1+x)secs    # if I divide it into 10 files

Am I wrong, If I say "Method B is much better" ?

Upvotes: 0

Views: 123

Answers (2)

Dimas Pante
Dimas Pante

Reputation: 2521

First of all, I would recommend that you use a CSS Minifier, like http://cssminifier.com/.

Regarding your speed test, in your case maybe is really faster to use multiple files, but try it and test your page at Google's PageSpeed Insights

Specially if your target is your own country, and if you know that the internet is slow all over there.

Upvotes: 1

Bijan
Bijan

Reputation: 8586

From Here

It's not about bandwidth speed but number of http requests, this makes a lot of sense for a mobile connection.

However the approach of having different css files to keep the project modular is solid, as it helps you keeping your css organized the way you want it without having all the code in one file only. Then you can benefit of css preprocessors / minifiers to concatenate and compress all your css files in a single one for production

Upvotes: 0

Related Questions