A RequireJS starter template with the Bower package manager
CSS JavaScript Shell
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
local
.gitignore
README.md
build.sh

README.md

Bower - RequireJS starter template

A RequireJS starter template with the Bower package manager for medium to large size projects.

Note: If you have no idea what this is, this short video will get you started: http://goo.gl/XIwt9

Tools

Tools that are used include:

  • Bower for package management
  • RequireJS for module loading/dependency management
  • A bash file for deploying with the RequireJS optimizer and for some cleanup

Bower & RequireJS must be installed globally via NPM like so:

sudo npm install -g bower requirejs

Note: If you want to verify that they were installed, you can check via the following commands after restarting your Terminal/iTerm:

which bower #=> /usr/local/bin/bower
which r.js  #=> /usr/local/bin/r.js

Bower

  • The directory: key in the .bowerrc file tells Bower where to install the project "packages"
  • The component.json file under the app's root directory tells Bower what dependencies our applicaiton has so we can install them all with one command like so: bower install. By specifying null for a version, we're asking for the latest version of that lib... I think!

RequireJS

The only srcipt tag that we add explicitly in the page is the following:

<script src="js/vendor/require.js" data-main="js/main.js"></script>

Build Process/Deployment

"RequireJS includes an optimization tool you can run as part of your packaging steps for deploying your code. The optimization tool can combine and minify your JavaScript files to allow for better performance."

Make sure that the build.sh file has the right permissions. If not change permissions with the following:

chmod +x build.sh

Once you're in the directory where the .sh file is, run the build file like so:

./build.sh