我一整天都在尝试让这个 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/