Java Reference
In-Depth Information
The same process is used to require the module as in the Common JS Module syntax. This
code would be placed in the main scripts.js file:
var random = require('./random');
To use Require.js, you only need to use a single <script> tag in your HTML file:
<script data-main="js/scripts.js" src="lib/
This uses a data- attribute to specify the name of the main JavaScript file to be loaded
first. Inside this script you can configure Require.js and also use the requireJS() func-
tion to require any modules:
//Any configuration goes in here
requirejs(['jquery', 'random']);
Search WWH ::

Custom Search