似乎当nodemon运行时,其他任务将挂起并且不会运行。我怎样才能同时使用它们?或者我是否可以使用nodemon来查看更少的文件并编译它们?
这是我的Gruntfile.js:
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
nodemon: {
dev: {
options: {
file: 'app.js',
nodeArgs: ['--debug'],
env: {
PORT: '3000'
}
}
}
},
less: {
development: {
options: {
paths: ['./public/less'],
yuicompress: true
},
files: {
'./public/css/test.css': './public/less/test.less'
}
}
},
watch: {
files: "./public/less/*.less",
tasks: ['less']
}
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-nodemon');
grunt.registerTask('default', ['less','watch']);
};
答案 0 :(得分:2)
您正在寻找的是grunt-concurrent,这项任务允许您异步运行多个任务,这对于阻止诸如watch或nodemon等任务非常常见。
https://github.com/sindresorhus/grunt-concurrent
至于nodemon,在“高级用法”部分下,使用grunt-concurrent直接在grunt-nodemon的github页面上找到了一个主要的例子。
https://github.com/ChrisWren/grunt-nodemon#advanced-usage
希望这是你正在寻找的。 p>