1
我正在使用grunt-express-server和grunt-contrib-watch爲我的開發環境獲取Livereload功能。但不知何故,瀏覽器重新加載不起作用,監視任務確實監聽對文件的更改,但不會導致重新加載瀏覽器。使用grunt-express-server和grunt-contrib-watch實時刷新
下面是Gruntfile.js
module.exports=function(grunt){
grunt.loadNpmTasks('grunt-express-server');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.initConfig({
watch: {
options: { livereload: true, },
express: {
files: [ 'views/index.ejs','app.js' ],
tasks: [ 'express:dev' ],
options: {livereload: true,
spawn: false
}
}
}
,
express: {
options: {
port:8080
},
dev: {
options: {
script: 'app.js'
}
}
}
});
grunt.registerTask('serve', [ 'express:dev', 'watch' ])
}
我已閱讀這篇文章grunt-express-server with contrib-watch和http://thanpol.as/grunt/Grunt-with-express-server-and-Livereload/,但無法弄清楚什麼是錯。
這裏是鏈接到代碼https://github.com/eMahtab/watch-reload
這裏是咕嚕的快照服務