As already highlighted, JavaScript libraries play an integral role in web app development. While they can be loaded in the HTML one by one, when you start using multiple libraries, this can become a little bit tricky when they become dependent on each other.
RequireJS solves this elegantly by providing a library to load JavaScript files in a modular way, which improves the speed and the quality of the code.
So far we were loading JavaScript files by referencing them using a dedicated <script src="library"></script> tag.
A typical structure of loading files using RequireJS looks as follows:
define( ["./jquery", "css!./css/layout.css" ], function($) { //jQuery was loaded and can be reference using $ in the code.
//a layout CSS files was loaded as well. As it's using the prefix CSS!...