These files are meant to help you quickly get up and running using Grunt with Express, with livereload and automatic app server reboots and automatic testing for rapid development. Client-side libraries are retrieved with bower
.
Note: It's important that you have the proper npm libraries globally installed:
$ npm install -g yo node-inspector nodemon grunt-cli bower karma istanbul
After installing the global dependencies above, run:
$ cd grunt-express-workflow
$ npm install
$ bower install
$ grunt server
And you're ready to go!
Popular client-side libraries included and configured:
Server-side libraries included and configured:
Testing Libraries included and configured:
Grunt plugins I included in package.json
and configured in Gruntfile.js
are:
- grunt-nodemon (~0.0.2)
- grunt-contrib-handlebars - for precompiled client-side templates
- grunt-concurrent (~0.2.0 !important)
- grunt-contrib-watch (~0.4.3 !important)
- grunt-simple-mocha
- grunt-karma
This scaffold is based off of the default Yeoman scaffold, started with
$ yo webapp
I've built on it from that initial state.
Karma, Istanbul, and Mocha run automated tests and coverage for the frontend and backend. This happens when development files or test files are changed during a grunt server
run, or when the grunt test
command is run on the command line. More information can be found in this blog post.
This and more in the companion blog posts to this repository.
-
If you want to
grunt build
for production with Handlebars in your project, you'll need to change the Handlebars runtime library code from the initialvar Handlebars = {};
tothis.Handlebars = {};
so that it'll be attached to thewindow
object and found by RequireJS modules. It seems this is being fixed upstream with the Handlebars developers at the time of this writing. -
There's an issue in the
grunt-contrib-watch
task where if two targets are watching the same file(s), only the last defined target will run if the file(s) change. Right now this means client-side tests will run and livereload will not when client-side scripts are saved. You can switch this behavior by altering the watch target order inGruntfile.js
. Watch grunt-contrib-watch issue #25 and upgrade your local copy of that library usingnpm
when it's fixed.
- 0.2.0 - Namespaced Karma task targets in the Gruntfile as well as Istanbul coverage output files.
- 0.1.0 - Added Karma, Mocha, and Istanbul for a full-featured frontend and backend test framework.