gulp-prompt pluginを介してユーザー入力を受け取る gulp タスクを作成しようとしています。しかし、その入力を他のものに渡すのに問題があります。
gulp.task('userinput', function(){
var myVar = 'MONKEY';
gulp.src('./templates/_component.*')
.pipe(prompt.prompt([
{
type: 'input',
name: 'userInput',
message: 'Say something'
}
], function(res){
myVar = res.userInput;
}))
.pipe(prompt.confirm('You said ' + myVar));
});
プロンプトで入力したと仮定するとhello
、確認で が表示されることを期待していましたYou said Hello
が、 と表示されますYou said MONKEY
。
これはGulpで可能ですか?