我目前正在使用 Grunt 和 livereload,但由于某种原因,在服务器文件更改时,它不再重新启动完整的服务器。它正在监视服务器文件,Reload server/some_dir/some_file.js
当文件更改时我会收到一条消息,但这似乎还不够。
watch: {
jade: {
files: [
'<%= yeoman.server %>/**/*.jade',
'<%= yeoman.app %>/**/*.jade'
],
tasks: ['jade']
},
compass: {
files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
tasks: ['compass']
},
livereload: {
options: { livereload: true },
files: [
'{.tmp,<%= yeoman.server %>}/**/*.js',
'{.tmp,<%= yeoman.app %>}/styles/{,*/}*.css',
'{.tmp,<%= yeoman.app %>}/scripts/**/*.js',
'{.tmp,<%= yeoman.app %>}/**/*.html',
'<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
],
tasks: ['livereload']
},
server: {
files: [ './server/**/*' ],
tasks: [ 'express:dev', 'livereload-start' ]
}
}
grunt.registerTask('server', [
'clean:server',
'jade',
'compass:server',
'express:dev',
'livereload-start',
'connect:livereload',
'watch' // if I replace this with 'watch:server' the server does restart properly, but html/css updates are obviously gone
]);