我想同时看我的咖啡和咕噜咕噜的文件。当我只看咖啡文件没有问题但是当我在我的文件中添加一个玉器观察者时,观察者只编译一次并且尽管有更新,观察者还没有编译这些新的更新。
非常感谢任何帮助:
以下是我系统中只有咖啡观察者的时间:
每当咖啡文件发生更新时进行编译:{{1}}
Gruntfile.coffee
问题是,为什么观察者在启动时才起作用,但现在不再起作用了?
仅在启动时进行编译:{{1}}
module.exports = (grunt) ->
grunt.initConfig
pkg : grunt.file.readJSON "package.json"
coffee :
compile :
options : sourceMap: on
files :
['dist/client/js/main.js': 'client/app/scripts/app.coffee',
'server.js': 'server.coffee']
watch :
coffee :
options : atBegin: yes
files : [ 'client/scripts/*.coffee',
'client/scripts/controllers/*.coffee',
'server.coffee']
tasks : ['coffee', 'jade']
grunt.loadNpmTasks 'grunt-contrib-coffee'
grunt.loadNpmTasks 'grunt-contrib-watch'
grunt.registerTask 'default', ['watch']
这是我的控制台注销命令:Gruntfile.coffee
module.exports = (grunt) ->
grunt.initConfig
pkg : grunt.file.readJSON "package.json"
coffee :
compile :
options : sourceMap: on
files :
['dist/client/js/main.js': 'client/app/scripts/app.coffee',
'server.js': 'server.coffee']
jade:
compile:
options:
data:
debug: false
files:
['dist/client/index.html': ['client/app/views/index.jade'] ]
watch :
coffee :
options : atBegin: yes
files : [ 'client/scripts/*.coffee',
'client/scripts/controllers/*.coffee',
'server.coffee']
tasks : ['coffee', 'jade']
grunt.loadNpmTasks 'grunt-contrib-coffee'
grunt.loadNpmTasks 'grunt-contrib-jade'
grunt.loadNpmTasks 'grunt-contrib-watch'
grunt.registerTask 'default', ['watch']
答案 0 :(得分:0)
你告诉watch
注意咖啡和玉器的变化,但只包含文件数组中的咖啡文件,我认为你需要添加jade
文件才能在那里观看
watch :
coffee :
options : atBegin: yes
files : [ 'client/scripts/*.coffee',
'client/scripts/controllers/*.coffee',
'server.coffee', 'client/app/views/index.jade'] // add the jade file here
tasks : ['coffee', 'jade']
watch:
coffee:
files: ["client/scripts/*.coffee", "client/scripts/controllers/*.coffee", "server.coffee", "client/app/views/index.jade"]
tasks: ["coffee"]
jade:
files: ["client/app/views/index.jade"]
tasks: ["jade"]