【发布时间】:2016-02-07 01:01:38
【问题描述】:
我在 node.js 中有一个 web 应用程序,我想用 nodemon 启动,所以每次主脚本更改时,webapp 都可以重新启动。
同时,我有我的咖啡脚本文件,每次更改时我都需要重新编译它们。
我已经设置了一个 grunt-contrib-watch 任务来监听app/frontend/*.coffee 文件,以调度咖啡解析器。
然而,这似乎并没有发生,因为 nodemon 任务也在监听。
我在 nodemon ignore 中设置了app/frontend/ 文件夹。
我还设置了 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']);
};
【问题讨论】:
标签: node.js gruntjs grunt-contrib-watch