You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be great to have a build script that pulled all js files from a folder into one file called main.js and then edited the links in the html head
process: git pull code source to production server. python script to concatenate / merge the separate js files into main.js thereby reducing the number of GET requests needed for the webapp to function.
If you check google pagespeed you'll see that they generally say better performing websites perform as few http requests as possible. As long as the difference in file size isn't insanely different it's generally better to have everything in one file.
Another plus is that all your javascript functions are downloaded and cached on page load, meaning no extra information to download on internal pages. Taking an OOP approach would be best where you have something like the following:
window.Sukey.init('page_name')
Which then runs all global javascripts, plus any extra ones on a per-page basis.
I'd advise a slightly more planned approach to this then just concatenating them if possible - it wil probably yield better performance.
Activity
samthetechie commentedon Nov 15, 2012
process: git pull code source to production server. python script to concatenate / merge the separate js files into main.js thereby reducing the number of GET requests needed for the webapp to function.
samthetechie commentedon Nov 15, 2012
We need some citations / references on why the "one file" approach is faster. Also need to discuss pros and cons and link to research / data.
Gaffen commentedon Dec 7, 2012
If you check google pagespeed you'll see that they generally say better performing websites perform as few http requests as possible. As long as the difference in file size isn't insanely different it's generally better to have everything in one file.
Another plus is that all your javascript functions are downloaded and cached on page load, meaning no extra information to download on internal pages. Taking an OOP approach would be best where you have something like the following:
window.Sukey.init('page_name')
Which then runs all global javascripts, plus any extra ones on a per-page basis.
I'd advise a slightly more planned approach to this then just concatenating them if possible - it wil probably yield better performance.