This is the most simple example of the usage of Require.JS. Define modules that you want to use with define
, then call them in the code where you want them used with require
.
Download r.js
from http://requirejs.org/docs/download.html#rjs
Run the following command:
node r.js -o name=main out=main-built.js
In your browser, navigate to index.html
Check out the optimized code at main-built.js