I have a 700kb decompressed JS file which is loaded on every page. Before I had 12 javascript files on each page but to reduce http requests I compressed them all into 1 file.This file is ~130kb gzipped and is served over gzip. However on the local computer it is still unpacked and loaded on every page. Is this a performance issue?I've profiled the javascript with firebug profiler but did not see any issues. The problem/illusion I am facing is there are jquery libraries compressed in that file that are sometimes not used on the current page.For example jquery datatables is 200kb compressed and that is only loaded on 2 of my website pages. Another is jqplot and that is another 200kb.I now have 400kb of excess code that isn't executed on 80% of the pages.Should I leave everything in 1 file?Should I take out the jquery libraries and load only relevant JS on the current page?
Loading main javascript on every page? Or breaking it up to relevant pages?
javascript;jquery;page speed;http;load
You can use requirejs to dynamically load the libraries you need only on that pages. Then you only have to load the requirejs (which is about 14k) on all pages, saving about 385kb.Integration is also very easy: just wrap the code you have with the require include stuff:require([jquery, jquery.alpha, jquery.beta], function($) {    //the jquery.alpha.js and jquery.beta.js plugins have been loaded.    $(function() {        $('body').alpha().beta();    });})