简体   繁体   English

等待异步 grunt 任务完成

[英]Wait async grunt task to finish

I received a grunt setup and one of the new tasks should execute (grunt.task.run) already existing task.我收到了一个 grunt 设置,其中一个新任务应该执行 (grunt.task.run) 已经存在的任务。 The task to execute is asynchronous, and the new task should wait until the async task has finished.要执行的任务是异步的,新任务应该等到异步任务完成。

What is the preferred way to do this?这样做的首选方法是什么?

grunt already got this covered, you should declare your task as an async one, and use the done() func in your task to tell grunt that it is done, look at this repo and this article , that have been very helpfull to me when I first had to deal with async tasks. grunt 已经涵盖了这一点,您应该将您的任务声明为异步任务,并在您的任务中使用 done() func 来告诉 grunt 它已完成,看看这个 repo这篇文章,它们对我非常有帮助我首先必须处理异步任务。

without a glimpse at your gruntfile, this is all i could say, but fell free to update your post with a link to the grunfile :)没有瞥一眼你的 gruntfile,这就是我能说的,但可以随意更新你的帖子,并提供 grunfile 的链接:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM