RequireJS dependency instance (recommended) and requirejs instance
Now let's take a look at the neat features of RequireJS:
The following is an html page:
At most one script statement introduces the require. js file and specifies another js file: config. js in data-main. Its definition is as follows:
require.config({ paths: { "jquery": "../third_party/jquery-1.8.0.min", "jquery.validate": "../../plugin/jquery-validation-1.9.0/jquery.validate", "jquery.artDialog": "../../plugin/artDialog4.1.6/jquery.artDialog" } }); require(["jquery"], function(util) { require(["jquery.validate", "jquery.artDialog"], function(util) { require(["masterUI", "masterSite", "configuration"], function(util) { $(document).ready(function() { window.configuration.init(); }) }); }); });
In require. config, configure the js File Location of the introduced third-party js library, including jquery, jquery. validate, and jquery. artDialog.
The next three require requests are called, with one layer. Note that the dependency sequence is the inner layer dependent on the outer layer. The first to be loaded is written to the outermost layer.
At the top of the page, we wrote a call, $ (document). ready (...), which was generally written in the html page. It is decoupled from html.
The above RequireJS dependency instance (recommended) is all the content shared by Alibaba Cloud xiaobian. I hope to give you a reference and support for the customer's home.