gruntjs - Grunt: flow control -


From my own work, I use the QTa-prompt to ask a Boolean Q Do not want to run or run any work based on the answer.

The problem is that grunt.task.run () does not actually run a function, but adds it to the queue.

P> So if I do my work:

  grunt.task.run ('hint: ask'); If (grunt.config ('answer')) {grunt.task.run ('do: something'); }  

If implemented quickly then really did not work ...

Is there any recommended way to do this?

Just like some syntax:

  grunt.task.run ('prompt: ask'). And then (function () {if (grunt.config ('answer')) {Grunt.task.run ('do: something')}}}  

Note: : Check whether the difference is from grunt.task.run

 

After answering, you must use the plugin to execute the code:

  prompt: {ask: {option: {question: [// your question here ... ], Then: function (result) {if (result [0]. Whatever) {// Clearly you will need to update this ... grunt.task.run ('hint: ask'); }}}}}  

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -