我試圖在更改我的文件時添加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