Wednesday, February 24, 2016

grunt-cli nodmon



npm install grunt-cli -g

install node mon

npm install grunt-nodemon -save-dev

add gruntfile.js to root of project

// gruntfile.js
module.exports = function (grunt) {
    grunt.initConfig({
        nodemon: {
            all: {
                script: 'server.js',
                options: {
                    watchedExtensions: ['js']
                }
            }
        },
    });
   
    grunt.loadNpmTasks('grunt-nodemon');
    grunt.registerTask('default', ['nodemon']);

};

open command prompt, type grunt to start monitoring, if server.js changes, it will restart node.



No comments:

Post a Comment