In order to run and configure Require.js perform the following steps:
Add a
script
tag in theindex.html
file located in thewww
folder, specifying the path for the library and the main file to load when the library is ready as the value of the attributedata-main
.<script data-main="js/main" src="js/libs/require/require.js"></script>
Note that when using Require.js you have to refer to the files without the
.js
extension.Create a file named
main.js
in thejs
folder and specify which are the paths of the main dependencies and other optional configurations (for a complete reference to the configuration options of Require.js refer to the online documentation available at http://requirejs.org/docs/api.html#config).require.config({ paths: { mustache: 'libs/mustache', alice: 'libs/alice.min', text: 'libs/require/plugins/text', templates: 'tpl' }, waitSeconds: 10 });
With the
waitSeconds
option you can...