gulp 怎么在下一个pipe里取文件名?


gulp.src('src/js/ /*.js').pipe("求解怎么在这个pipe里取到 目录名和*.js文件名")

gulp node.js

发呆的懒猫 9 years ago

取决于你要干嘛

啊成成成成君 answered 9 years ago

through2 这个插件。


 js


 var through = require('through2');

gulp.task('xx',function(){
    return gulp.src('src/js/*.js')
        .pipe(through.obj(function(file,enc,cb){
            console.log(file.relative);
            console.log(file.path);
            this.push(file);
            cb();
        }))
});

starbac answered 9 years ago

Your Answer