-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use prompt without pipe #22
Comments
I think that this Is not posible. |
I haven't really investigated why this works, but if you call gulp.task('install', function(){
var prompter = gp_prompt.prompt(
{ type: 'input'
, name: 'dbname'
, message: 'Type your DB name:'
},
function (res){
gulp.src('config./db.js')
.pipe(gp_replace('_DBNAME_', res.dbname))
.pipe(savefile())
}
)
prompter.write()
return prompter()
}); This probably has something to do with gulp not liking the Stream that Inquirer is returning |
I miss this feature too. I tried a confirm question with write(), @codyrushing . It didn't work as expected for me. The task was finished and then the question shown up. |
Solved with Inquirer.js which is the library used by gulp-prompt Example: Both stop the gulp execution when the answer is 'no'. //gulp-prompt
gulp.task('prompt', () => {
const question = {
message : 'Do you want to continue?(no)',
default : false
};
return gulp.src('file')
.pipe(prompt.confirm(question));
}); //Inquirer.js
gulp.task('prompt', () => {
const question = [
{
type : 'confirm',
name : 'continue',
message : 'Do you want to continue?(no)',
default : false
}
];
return inquirer.prompt(question).then(answer => {
if (!answer.continue) {
return process.exit (2);
}
});
}); |
I am going to close this issue out since yuricamara seems to have provided a solution. If there is still any outstanding questions or concerns please let me know. |
Hi, take a look @ this code:
There's a way to use
gulp-prompt
without open 2gulp.src('config/db.js')
?The text was updated successfully, but these errors were encountered: