我将 Grunt 与执行监视任务的 grunt 服务器任务一起使用。不幸的是,在保存了一个less或coffee文件后,应该由watch taks触发的“默认”任务没有被触发,因此浏览器不会重新加载。
我正在寻找问题,但没有找到合适的解决方案。
这是我的Gruntfile.coffee的摘录:
grunt.registerTask "server", [
'less'
'coffee'
'copy'
"concurrent:server"
"connect:livereload"
"open"
"watch"
]
grunt.registerTask "default", [
'less'
'coffee'
'copy'
]
watch:
coffee:
files: [
'<%= assets %>/scripts/{,*/}*.coffee'
'Gruntfile.coffee'
'<%= assets %>/scripts/*.coffee'
]
less:
files: [
'<%= assets %>/styles/**/**/*.less'
'<%= assets %>/styles/**/*.less'
'<%= assets %>/styles/*.less'
]
files: [
'app/**/*.php'
'app/**/*.html'
]
tasks: 'default'
livereload:
options:
livereload: LIVERELOAD_PORT # is 37562
files: [
"<%= assets %>/{,*/}*.html"
'<%= assets %>/styles/**/*.less'
'<%= assets %>/scripts/*.coffee'
'<%= assets %>/styles/**/*.less'
'<%= assets %>/styles/*.less'
]
提前谢谢你的帮助!:)