问题
I'm trying to run multiple watch tasks with grunt, but it seems to not be able to. I'm using grunt concurrent, but it seems to only run a portion of the tasks I specify, stopping just short.
Here is the snippet of my gruntfile:
concurrent:
compile:
tasks: ["watch:app", "watch:html", "watch:images", "watch:lib", "watch:server"]
options:
logConcurrentOutput: true
When I run this, the output shows:
Running "concurrent:compile" (concurrent) task
Running "watch:images" (watch) task
Waiting...Running "watch:app" (watch) task
Waiting...Running "watch:html" (watch) task
Waiting...Running "watch:lib" (watch) task
Waiting...
For some reason, it's skipping my server task completely. I initially thought the server tasks was not setup correctly, but I can remove a watch task, and it will correctly run the server task along with the other 3, it just cannot run all 5 at once.
Am I implementing this inappropriately?
回答1:
So from the documentation, simply declare the amount of tasks you want. so in your case:
options:
logConcurrentOutput: true
limit: 5
By default it just uses how many cores your CPU has..
limit
Type: Number Default: Number of CPU cores (require('os').cpus().length) with a minimum of 2
Limit of how many tasks that are run concurrently.
https://github.com/sindresorhus/grunt-concurrent
来源:https://stackoverflow.com/questions/20865228/grunt-concurrent-cannot-run-too-many-tasks