A basic application that demonstrates the use of Backbone.Marionette. In addition to it's primary focus of Backbone.Marionette, this app also show-cases the use of:
- browserify - Client-side dependency module loader
- bower - Client-side package manager
- handlebars - HTML templating framework
- slinker - Symlinker for browserify and node dependencies--removes the need for relative paths
- Bootstrap - HTML, CSS, and JS framework for simplifying responsive web pages and applications
- grunt - Build-time task automation
- grunt-browserify - Manages the browserify dependency lifecycle through grunt
- grunt-bower-concat - Concatentates Bower packages into a single dependency file
- hbsfy - Handlebars build-time template compiler
- grunt-contrib-cssmin - Used to concatenate CSS files together
- grunt-contrib-watch - Runs tasks whenever configured files are changed
First, run npm install
:
$ cd <root-of-app>
$ npm install
The npm install
command pulls down all of the necessary node dependences. In addition, it also symlinks the js
directory folders to eliminate the need for relative paths.
To generate the client artifacts, use the Grunt task runner:
$ cd <root-of-app>
$ grunt build
This will generate the client/dist/client.js
artifact as well as the client/dist/client.css
artifact. These artifacts are used by the index.html
page to run the Marionette application.
Before running for the first time, make sure to execute the Installation instructions. Once you've done that, you can run the application by executing npm start
:
$ cd <root-of-app>
$ npm start
During development, you'll frequently make changes to files. This will require would require you to run grunt build
each time to see your changes reflected. Enter Grunt Watch. You can use the grunt watch
command to have Grunt automatically execute the grunt build
task for you every time it detects that there were changes that were JavaScript or CSS changes saved. It will rebuild all of the necessary assets automagically. Upon completion, you can simply refresh your browser and the changes will be reflected. Neat!
To use, get the application running (see Running). Once your application is running, open a new console window and execute grunt watch
:
$ cd <root-of-app>
$ grunt watch
Try deleting the node_modules
directory and then running npm install
again.
Try deleting the node_modules
directory and then running npm install
again. In addition, delete the bower_components
directory and then run grunt build
.