1

Im trying to use gulp prompt:

gulp.src('test.js')
    .pipe(prompt.prompt({
        type: 'input',
        name: 'task',
        message: 'Which task would you like to run?'
    }, function(res){
        //value is in res.task (the name option gives the key) 
 }));

Im confused to actually what gulp.src is for? I don't have a src I just want to prompt the user for an input.

1 Answer 1

3

gulp.src creates the stream of source files to perform the 'piped' operations on. In your example you're asking for a task to perform, which means you're asking what task to perform on the file test.js.

If you want to ask what task to perform, and then run one or more gulp tasks I think you'll need to write a plain old nodejs application that asks for the input and then start the gulp [name of task] from there.

2
  • Thanks, the code was just an example from gulp prompt. What if I don;t want to create a stream of source files and just run the prompt?
    – panthro
    Commented Nov 10, 2016 at 8:44
  • 1
    That's not what gulp is for. If you just want a prompt and do something that is not file related (what gulp is for) you should probably just use nodejs and call your prompt script from there
    – Robba
    Commented Nov 10, 2016 at 8:46

Not the answer you're looking for? Browse other questions tagged or ask your own question.