1
我在node.js中有一个web应用程序,我想从nodemon开始,所以每次主脚本更改时,webapp都可以重新启动。 同时,我有我的咖啡脚本文件,我需要重新编译每次他们任何一个变化。 我已经设置了一个grunt-contrib-watch任务来侦听app/frontend/*.coffee
文件,以分派咖啡分析器。 但是,由于nodemon任务也在监听,因此这看起来似乎没有发生。 我在nodemon ignore中设置了文件夹。 我也设置了nodemon并监视为并发。 不过,每次我编辑咖啡脚本时,咖啡任务都不会执行。如何让grunt watch和grunt nodemon一起工作
这是我Gruntfile
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
concurrent: {
dev: [
'nodemon',
'watch'
],
options: {
logConcurrentOutput: true
}
},
coffee: {
compile: {
files: {
'app/public/app.js': ['app/frontend/*.coffee']
}
}
},
nodemon: {
dev: {
script: 'app/index.js',
options: {
ignore: ['app/frontend/**', 'app/public/**']
}
}
},
watch: {
scripts: {
files: 'app/frontend/*.coffee',
tasks: ['coffee'],
options: {
spawn: false
}
}
}
});
grunt.loadNpmTasks('grunt-concurrent');
grunt.loadNpmTasks('grunt-contrib-coffee');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-nodemon');
// Default task(s).
grunt.registerTask('default', ['coffee', 'nodemon', 'watch']);
};