通过选择'gulp-studio',我的初始if语句无法实现。无论我选择什么,以下代码总是将“再见”输出到控制台。我已经尝试了很多不同的变种,但没有任何线索。
var gulp = require('gulp'),
prompt = require('gulp-prompt'),
gulpif = require('gulp-if'),
shell = require('gulp-shell');
var response = 'response';
gulp.task('studio-wizard', function(){
return gulp.src(sourced.app, {read: false})
.pipe(prompt.prompt([{
type: 'checkbox',
name: 'bump',
message: 'Which version of Studi˚ would you like?',
choices: ['gulp-studio', 'gulp-studio-vvv']
}
], function(res){
if (res.bump.indexOf("gulp-studio") > -1) {
response = 'hello'
} else {
response = 'bye'
}
}));
});
gulp.task('generate-studio', ['studio-wizard'], function() {
return gulp.src(sourced.app)
.pipe(shell([
'echo' + ' ' + response
]))
});
有人可以解释如何解决这个问题吗?