mcgraths
2/3/2015 - 1:41 PM

Gruntfile to start a dev server and livereload for all file changes (in a "public" subfolder)

Gruntfile to start a dev server and livereload for all file changes (in a "public" subfolder)

//npm install grunt-contrib-connect grunt-contrib-watch load-grunt-tasks --save-dev

module.exports = function(grunt) {

    // Project configuration.
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        watch: {
            all: {
                files: ['public/**/*'],
                options: {
                    livereload: true
                }
            }
        },
        connect: {
            server: {
                options: {
                    port: 9000,
                    hostname: "localhost",
                    base: 'public',
                    livereload: true
                }
            }
        }

    });

    require('load-grunt-tasks')(grunt);

    // Default task(s).
    grunt.registerTask('default', ['connect', 'watch']);

};