Большая Тёрка / Мысли / Личная лента olegchir /
module.exports = function (grunt) { ... grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-shell-spawn'); ... grunt.registerTask('stopNode', function() { grunt.util.spawn({ cmd: 'killall', args: ['node'], fallback: 0 }, function (error, result, code) {return 0}); }); grunt.registerTask('startNode', ['shell:startNode']); grunt.registerTask('restartNode', ['stopNode','startNode']); ... watch: { options: { livereload: true, nospawn: true }, coffee: { files: ["./*.coffee", 'routes/*.coffee'], tasks: [ "coffee", "restartNode" ] } }, shell: { startNode: { command: ["node ./app.js"], options: { async: true, execOptions: { cwd: './', detached: true } } }, options: { stdout: true, stderr: true, failOnError: false } } ... }); };