Gruntjs Livereload使用Grunt watch加载本地url

Gruntjs Livereload使用Grunt watch加载本地url,gruntjs,livereload,Gruntjs,Livereload,我正在开发一个没有后端/服务器的小型HTML/JS/SASS项目,我正在尝试让Livereloading开始工作 在我的grunt.initConfig中,我有: options: { livereload: true, }, 但在Chrome中,我无法在本地html文件上激活Liverload插件 file:///C:/Users/alucardu/Documents/Visual%20Studio%202015/Projects/JS-demo/JS demo/index.html 这

我正在开发一个没有后端/服务器的小型HTML/JS/SASS项目,我正在尝试让Livereloading开始工作

在我的grunt.initConfig中,我有:

options: {
  livereload: true,
},
但在Chrome中,我无法在本地html文件上激活Liverload插件

file:///C:/Users/alucardu/Documents/Visual%20Studio%202015/Projects/JS-demo/JS demo/index.html


这是可能的,还是我需要运行服务器?

显然,Grunt为此提供了一个名为
connect
>

当我安装它时,我将其添加到我的GrunFile中:

    connect: {
        server: {
            options: {
                open: true,
                keepalive: true,
                hostname: 'localhost',
                port: 8080,
                base: ''
            }
        }
    },

现在我可以运行一个本地静态服务器了:)

显然,Grunt为此提供了一个名为
connect
>

当我安装它时,我将其添加到我的GrunFile中:

    connect: {
        server: {
            options: {
                open: true,
                keepalive: true,
                hostname: 'localhost',
                port: 8080,
                base: ''
            }
        }
    },
现在我可以运行本地静态服务器:)