##Purpose
To learn basic configuration of RequireJS and require.config
.
##Why RequireJS
RequireJS is useful for building modularized enterprise JavaScript applications.
- we no longer have to control file loading, RequireJS does it elegantly for us
- creation of modules (even though ES6 provides module loading, RequireJS came prior and is very stable)
- lazy loading of app resources makes enterprise apps lightweight (incrementally loading things as needed)
##Project structure setup
npm install bower
bower init
touch .bowerrc
(then open it and add this)bower install requirejs --save
touch index.html
mkdir js && cd js
touch main.js
mkdir modules
cd ..
How that should look like:
├── bower.json
├── index.html
└── js
├── libs
│ └── requirejs
│ ├── LICENSE
│ ├── README.md
│ ├── bower.json
│ └── require.js
├── main.js
└── modules
##Implementing KnockoutJS