Gruntfile:livereload不起作用

时间:2015-01-10 03:03:47

标签: javascript express gruntjs

我在终端上没有任何问题,但Chrome没有回复我的html文件,也没有自动重新加载页面。 我提供了#livereload.js'在我的index.html中,但我不确定是否需要它。 谢谢你的帮助。

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: ['/Users/antoine/Dropbox/prog/projets/antoine/'],
            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,
                interval: 1500,
        }
    }
},

// grunt-open will open your browser at the project's URL
// https://www.npmjs.org/package/grunt-open
open: {
    all: {
        path: 'http://localhost:8080/index.html'
    }
}
});

// Creates the `server` task
grunt.registerTask('server', [
    'express',
    'open',
    'watch'
    ]);
};

0 个答案:

没有答案