javascript - grunt-contrib-watch livereload 不重新加载

标签 javascript gruntjs livereload

我一整天都在尝试让这个 livereload 工作,但我被难住了。我的 grunt.js 文件在下面,我确保在我的 html 文件的末尾添加我的脚本。有什么想法吗?

module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.initConfig({
    uglify: {
        my_target: {
            files: {
                '_/js/script.js' : ['_/components/js/script.js']
            }//files
        } //mytarget
    }, //uglify
    watch: {
        options : { livereload: true },
        scripts: {
        files: ['_/components/js/*.js'],
        tasks: ['uglify']
    }, //scripts
    html: {
        files: ['*.html']
    }//html
    }//watch
}) // initconfig
grunt.registerTask('default', 'watch');
} //exports

最佳答案

尝试使用浏览器 extension用于实时加载。

关于javascript - grunt-contrib-watch livereload 不重新加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22498743/

相关文章:

javascript - 胜利: Animating Circular Progress Bar - not rendering chart

Javascript OOP 帮助/建议/解释

Javascript switch 语句——非常简单,我做错了什么?

node.js - npm 安装不起作用

gruntjs - 具有可变文件名的 grunt-file-creator

javascript - Vanilla JS 查询选择器没有抓取 dom 中的元素?

css - 编译 less 文件不获取全局 less 变量

angularjs - 如何使用 nginx 和本地 tomcat 设置 grunt live-reload 任务

ruby-on-rails - LiveReload on Rails 4.1.8 无法在 Chrome 或 Safari 中工作

android - Ionic4 电容 android livereload?