我试图在更改我的文件时添加broser livereload,但浏览器不能重新加载,我无法得到原因,我做的全部都像描述的here,并且浏览器在我tun grunt时打开,然后当改变index.html
,在控制台得到浏览器不能重新加载Grunt Livereload
Waiting...
>> File "index.html" changed.
Completed in 0.000s at Wed Jun 03 2015 11:45:24 GMT+0300 (EEST) - Waiting...
>> File "index.html" changed.
Completed in 0.000s at Wed Jun 03 2015 11:54:11 GMT+0300 (EEST) - Waiting...
>> File "index.html" changed.
Completed in 0.000s at Wed Jun 03 2015 12:01:30 GMT+0300 (EEST) - Waiting...
,但浏览器不重装,我在做什么错?也许我想念什么?我试图谷歌搜索问题,但没有得到任何有用的结果...如果你需要我的Gruntfile或任何,只要对我说。谢谢!
这里是我的Gruntfile.js:
module.exports = function(grunt) {
// Load Grunt tasks declared in the package.json file
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
// Configure Grunt
grunt.initConfig({
// Grunt express - our webserver
// https://github.com/blai/grunt-express
express: {
all: {
options: {
bases: ['var\\www\\megapolis'],
port: 8080,
hostname: "localhost",
livereload: true
}
}
},
// grunt-watch will monitor the projects files
// https://github.com/gruntjs/grunt-contrib-watch
watch: {
all: {
files: '**/*.html',
options: {
livereload: true
}
}
},
// grunt-open will open your browser at the project's URL
// https://www.npmjs.org/package/grunt-open
open: {
all: {
path: 'http://localhost/megapolis/index.html'
}
}
});
// Creates the `server` task
grunt.registerTask('server', [
'express',
'open',
'watch'
]);
};
请附上相关你的grunt文件的部分,所以我们可以看到你是如何试图完成这一点。 – Lix
您在index.html中没有使用AppCache清单吗?如果您使用脱机缓存,浏览器将不会重新加载。上周我有这个问题。 –
@jonnyknowsbest,不,我没有使用缓存... – nowiko