diff --git a/Gruntfile.js b/Gruntfile.js index 68e46c7..f4ed5b0 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -34,14 +34,33 @@ module.exports = function(grunt) { options: { mangle: false } + }, + + watch: { + client: { + files: ['app/client/**/*.js'], + tasks: ['debug'] + } + }, + + nodemon: { + dev: { + script: ['app/server'], + options: { + watch: ['app/server'] + } + } } }); grunt.loadNpmTasks('grunt-browserify'); + grunt.loadNpmTasks('grunt-nodemon'); grunt.loadNpmTasks('grunt-contrib-uglify'); + grunt.loadNpmTasks('grunt-contrib-watch'); grunt.registerTask('build', ['browserify:pro', 'uglify']); grunt.registerTask('debug', ['browserify:dev']); + grunt.registerTask('server', ['nodemon']); } \ No newline at end of file diff --git a/README.md b/README.md index 4fdbd1c..eadebc3 100644 --- a/README.md +++ b/README.md @@ -20,4 +20,6 @@ This will start the application on port `3000` or the one specified by the `PORT ###Grunt tasks * `grunt debug` - Builds the client-side javascript application with no minification -* `grunt build` - Builds the client-side javascript application with minification \ No newline at end of file +* `grunt build` - Builds the client-side javascript application with minification +* `grunt watch` - Automatically runs `grunt debug` when client-side code changes +* `grunt server` - Starts server and automatically restart when server-side code changes \ No newline at end of file diff --git a/package.json b/package.json index a18a906..098fab7 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,8 @@ "grunt": "^0.4.5", "grunt-browserify": "^3.7.0", "grunt-contrib-uglify": "^0.9.1", + "grunt-contrib-watch": "^0.6.1", + "grunt-nodemon": "^0.4.0", "mineflayer": "git@github.com:andrewrk/mineflayer.git", "socket.io": "^1.3.5", "socket.io-redis": "^0.1.4"