Search code examples
javascripthtmlbuild-system

Is it faster to bake javascript into html?


I heard that requesting many single Javascript files in a HTML page is slow, so I wonder if it is faster to bake all those files directly into the HTML code using a build system or does the page load quicker when all JS files were merged into one file that than is requested by the HTML document?

I'm only considering the initial loading time, as caching obviously would equalise any difference.


Solution

  • There isn't any difference once the code is loaded. The browser will load all pages on cache and it will loaded as faster as marge file.

    There will be a difference to load first page but it is not remarkable.