KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I need to optimize the loading speed of several existing websites. One of the issues that I have is the amount of requests per page. The websites have 7 or more different types of pages which should load different set of css and javascripts because they contain different widgets or functionality. Currently each widget or functionality has its own javascript file. I am planning to combine and minify the files to have fewer requests. Would it be a good practice to combine and minify all javascripts necessary on each type of page into one file (and to do the same for css)? e.g. home page has just one homepage.js , list pages have just listing.js , detail pages have just detail.js , etc. Is it better to combine only those files which are always used together? e.g. jquery.js + jquery.cookie.js + common.js , list.js + paging.js + favorite.js , detail.js + favorite.js , etc. What about having one file for all javascripts that should load in the head and one file for all javascripts that should load at the end of body, e.g. init.js goes to <head> and do.js goes to <body> . What about having one file for common functions and one for administrative functions which is loaded if the user has specific permissions? Are there any strategies how to balance between 1., 2., 3., and 4.? What is a recommended amount of javascript and css requests for a page? I am considering large-scale websites a.k.a. portals or social networks. (BTW, there are some libraries which requests I can't control, e.g. TinyMCE or google maps).
Tags (comma-separated)
Save Edits
Cancel