【发布时间】:2014-04-08 22:03:23
【问题描述】:
我不得不在 grunt watch 中覆盖我的一个手表事件
grunt.event.on 'watch', (action, filepath, target) ->
# does something ...
如何在最后手动触发 livereload?
grunt.task.run('livereload'....)?
【问题讨论】:
标签: gruntjs livereload
我不得不在 grunt watch 中覆盖我的一个手表事件
grunt.event.on 'watch', (action, filepath, target) ->
# does something ...
如何在最后手动触发 livereload?
grunt.task.run('livereload'....)?
【问题讨论】:
标签: gruntjs 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
【讨论】: