Larger single files or several smaller files?

Hello everyone,

I have kind of a basic question that I’d like to hear the opinions of others on.

Basically, my question is: do you think it is better to have one larger file or several smaller files for your website, when it comes to things like CSS and Javascript files.

Personally, if you can assume that most of the CSS and Javascript will get used by every visitor, I think it’s better to have a single larger file as opposed to smaller ones. The reason is that it may take a bit longer to load initially, but afterward all the other pages would load faster since those files are already cached.

If the file sizes are too large that it causes the first page to load too slow, and you’ve optimized the files as much as you can, it could be beneficial to create two files: one for the front page and one that has everything else.

So, that’s my opinion. What are yours?