我不得不在grunt watch 中覆盖我的一个手表事件
grunt.event.on 'watch', (action, filepath, target) ->
# does something ...
我如何在最后手动触发liverload?
grunt.task.run('livereload'....)?
我只在进程结束时编写的一个文件上设置了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