Slide 1

Slide 1 text

The JavaScript Task Runner

Slide 2

Slide 2 text

What is Grunt? Grunt is like Ant, Make, Rake, SCons, etc. but, Javascript. NPM.

Slide 3

Slide 3 text

build script

Slide 4

Slide 4 text

Automate your build So you can: ... do continuous integration, ... release to production without fear, ... work on more interesting things.

Slide 5

Slide 5 text

Is Grunt for me? frontend backend mixed Backbone, Ember, Angular REST/WebSocket API Express.js

Slide 6

Slide 6 text

Grunt Plugins grunt-contrib: 26 and growing Community: 450+

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

Using Grunt 1. Create package.json 2. Gruntfile.js 3. Run npm install 4. grunt [task[:target]]

Slide 9

Slide 9 text

package.json { "name": "hello-world", "version": "0.1.0", "dependencies": { "grunt": "~0.4.0", "grunt-contrib-jshint": "~0.1.1", "grunt-contrib-uglify": "~0.1.1" } }

Slide 10

Slide 10 text

Gruntfile.js module.exports = function (grunt) { grunt.initConfig({ uglify: { build: { src: 'app.js', dest: 'build/app.min.js' } }, jshint: { all: ['**/*.js'] } }); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.registerTask('default', ['jshint', 'uglify']); };

Slide 11

Slide 11 text

Have it your way Declarative Imperative

Slide 12

Slide 12 text

Demo

Slide 13

Slide 13 text

Poor Man's CI $ sudo -i # crontab -e */5 * * * * cd /var/www/myapp.com && git reset --hard && git pull origin master && npm install && npm test && grunt

Slide 14

Slide 14 text

I am Sebastiaan I email seb@cf.sg I blog ninja.sg I work cf.sg I code git.io/seb