简体   繁体   English

gulp.src是做什么的?

[英]What is gulp.src for?

Im trying to use gulp prompt : 我正在尝试使用gulp提示符

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? 我对gulp.src实际上是什么感到困惑? I don't have a src I just want to prompt the user for an input. 我没有src,我只想提示用户输入。

gulp.src creates the stream of source files to perform the 'piped' operations on. gulp.src创建源文件流以对其执行“ piped”操作。 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 . 在您的示例中,您要执行的任务是要在文件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. 如果您想询问要执行什么任务,然后运行一个或多个gulp任务,我认为您需要编写一个普通的旧的nodejs应用程序,要求输入,然后从那里启动gulp gulp [name of task]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM