Forum Moderators: open

Message Too Old, No Replies

Multiple js files vs Single File

         

angrish

7:02 pm on Jul 23, 2003 (gmt 0)

10+ Year Member



Hi,
This is my first post on this site and hope will find the suitable answer to this,

Does it really makes a difference(in case of download time ) loading multiple js files vs single js file, with exact same stuff.

then it must be true for the css files also.

As i am supposed to make the Login page fast which loads the 13 js files(all required) and the 7 css files

Thanx in advance

g1smd

7:32 pm on Jul 23, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



It is always a trade off. If you have external CSS and JS files then they are usually cached in the browser and all subsequent pages visited by that browser will load more quickly. However, it slows the first page down a bit. You might lose the odd visitor if it is too slow.

MWpro

7:40 pm on Jul 23, 2003 (gmt 0)

10+ Year Member



I always like having things all in one file; makes things more organized in my opinion.

It also depends on how long your file is going to be, and whether you use those styles/scripts on every page or not. If you are only gonna use a script on 3 pages, then maybe it is better to split it up.

But unless the files are very big, I don't think it's going to affect the page loading time that much and it's not worth splitting them up.

WibbleWobble

9:14 am on Jul 24, 2003 (gmt 0)

10+ Year Member



If multiple scripts are going to be used on a majority of pages, merging them into one commented file is beneficial, as it reduces the number of GET requests each page creates. Plus it keeps everything tidy and obvious.