I think it depends how often they change. Let's take this example:
- JQuery: change once a year
- 3rd party plugins: change every 6 months
- your custom code: change every week
If your custom code represents only 10% of the total code, you don't want the users to download the other 90% every week. You would split in at least 2 js: the JQuery + plugins, and your custom code. Now, if your custom code represents 90% of the full size, it makes more sense to put everything in one file.
When choosing how to combine JS files (and same for CSS), I balance:
- relative size of the file
- number of updates expected
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…