我不得不用grunt watch
覆盖我的一个观看事件grunt.event.on 'watch', (action, filepath, target) ->
# does something ...
如何在最后手动触发livereload?
grunt.task.run('livereload'....)?
答案 0 :(得分:1)
我通过在我的流程结束时只在一个文件上设置livereload来解决这个问题。
以下是一个例子:
module.exports = (grunt) ->
grunt.initConfig
watch:
reload:
options:
livereload: true
files: "refresh.txt"
css:
files: ["**/*.css"]
js:
files: ["**/*.js]
# ... and all your tasks
grunt.event.on 'watch', (action, filepath, target) ->
# does something ...
if target isnt 'reload'
data = "#{grunt.template.today("isoDateTime")}\n"
require('fs').appendFileSync "refresh.txt", data