【问题标题】:Gruntjs Livereload not workingGruntjs Livereload 不工作
【发布时间】:2015-01-28 02:47:08
【问题描述】:

我似乎无法让 livereload 选项处理 grunt-contrib-watch 任务。

我的 html 文件底部附有本地主机 livereload.js 文件。

当我转到http://localhost:35729/ 时,我得到的只是以下内容:

{"tinylr":"Welcome","version":"0.0.5"}

一切似乎都已设置并正常工作。即使我运行grunt --verbose,它也会说 Live reload server started on port: 35729.

下面是我的 gruntfile 中的手表配置

任何帮助将不胜感激!

      watch: {
        options:{
            livereload: true,
        }

        styles: {
            files: ['less/**/*.less'], // which files to watch
            tasks: ['less'],
            options: {
                nospawn: true
            }
        },
        html:{
            files: ['site/**/*.html', 'includes/**/*.html'],
            tasks: ['includes'],
            options: {
                nospawn: true,
            }
        }

    }
}); 

【问题讨论】:

    标签: gruntjs livereload


    【解决方案1】:

    您看到的输出是正确的。 http://localhost:35729 是 LiveReload 服务器,而不是您的应用程序。

    查看您的代码,您没有在 index.html 中包含 LiveReload 脚本。

    我已经向您发送了一个拉取请求,并且可以确认 LiveReload 正在运行。

    【讨论】:

    • 嗯...我试过 localhost:9000 ,它说网页不可用。这是我的 gruntfile.js jsfiddle.net/t73evmwj 的链接
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-02-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-14
    • 2013-05-13
    • 2016-02-25
    相关资源
    最近更新 更多