From my own task, I what to use grunt-prompt
to ask a boolean Q and then run or don't run a task based on the answer.
The problem is that grunt.task.run() does not actually run a task but rather adds it into a queue.
so if I do from my own task:
grunt.task.run('prompt:ask');
if (grunt.config('answer')) {
grunt.task.run('do:something');
}
When the if executes the prompt task did not actually run yet...
Is there a recommended way to do this?
maybe some syntax like:
grunt.task.run('prompt:ask').andThen(function(){
if (grunt.config('answer')) {
grunt.task.run('do:something');
}
})
Note To Self: Check what grunt returns from grunt.task.run
You'll need to use the
then
option for the plugin to execute code once an answer is entered: