Do javascript loaders replace the need to do script combining?
Do script loaders replace the n开发者_开发问答eed to do script combining?
Or are they really complementary tools?
JavaScript loaders only defer JavaScript loading and provide lazy load or on-demand load experience for us. But they don't reduce HTTP requests. Thus, it totally depends. If you load 200KB of JavaScript as a combined file at first and only use 10KB, then you'd better separate JavaScript codes into their original files and use a loader to defer loading process to increase your performance.
complementary ... script loaders are only for optional or occasional dependencies. combining scripts is about optimizing the scripts that you know you will always need on a page
Usually scriptloades will not/can not combine your javascript files on the fly, unless you're using some kind of optimizating proxy or have some logic up and running on the serverside.
One scriptloader which does both (combining + transfering) is supplyJS.
精彩评论