panthro panthro - 1 year ago 103
Javascript Question

What is gulp.src for?

Im trying to use gulp 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.

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download