Colin Gemmell (@colin_gemmell) was talking about using automating with grunt.js at Scotland.js, these are my notes from his talk.
Good developers should be extremely lazy - get bored doing something more than once.
Yeoman is a scaffolding tool that runs on top of grunt to build out a project template.
Gruntfile.js. This is plain JS. Define tasks in the file and load plugins using NPM. Getting JSHit is four lines of JS. Contrib package can install dependencies - such as phantom.js. Tasks can be combined into single tasks to run them together.
Two watch plugins:
watch- default grunt watch plugin.
regarde- sends notification of file(s) changed so can only run relevant tasks.
Live reload can be used to automatically reload the browser once the tasks have run. This can effectively make your IDE a live editor in the browser.
Can use plugins to upload to S3 for deployment. Concatenate, minify and build can all be run prior to deployments.
package.json file to describe dependencies. Can hook this into grunt to avoid duplicating this information.
When a task fails grunt stops so you can get deployment only when all tasks succeed.