The problem with above code is that to download all the stylesheets and scripts, the web browser will make 10 different HTTP requests to the server, one for each file. HTTP requests are slow and can increase page load time on the client side and hamper performance on the server side. So we are going to see how can we reduce the number of HTTP requests required to load all the files.
One of the simplest solution is to combine all the different files into one single file on the server-side and then fetch it on the client-side using only a single HTTP request.
This technique is called suturing and is popularly used to reduce server load, page load time and increase site performance.
On the server, create 2 new files called allStyles.css.php and allScripts.js.php in the /path/to directories.
We have now reduced the number of HTTP requests required from 10 to just 2!
Though we are still giving the server some extra work in form of include statements, they are still quicker than separate HTTP requests.
If you are using any other language on back-end, you can still implement suturing using functions equivalent to php’s include().