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

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

阅读 8.3k
2 个回答

through2这个插件。

jsvar 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();
        }))
});

取决于你要干嘛

推荐问题