Reputation: 3063
I have several scripts on my website. Would it make sense to group them all into one single file? Or is it preferable to keep them separate?
Upvotes: 0
Views: 1181
Reputation: 2126
For production best:
For fallback frameworks load (google can be down too)
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">window.jQuery || document.write('<script type="text/javascript" src="js/jquery.min.js"><\/script>')</script>
Upvotes: 2
Reputation: 72652
For production I would always group them into one file and compress and/or minify them. Browser can only (used to?) make 2 requests at the same time to the same domain.
If it is a onetime action you can use this website to minify the files. Other wise you would have to look into automating the process.
But please also keep your original uncompressed files for if you want to make changes at some point.
Upvotes: 5