gulp: 获取正在传递的文件的文件名

gulp: acquire filename of file being passed

如何获取在 gulp-jshint 中传递的文件的文件名?

gulp-tap 将帮助您打印正在使用的文件的名称 gulp-src...

var gulp = require('gulp');
var path = require('path');
var tap = require('gulp-tap');

gulp.task('examples', function() {
    return gulp.src('./examples/*.html')
        .pipe(tap(function (file,t) {
            console.log(path.basename(file.path));
            // Do something with the file name
        }))
        .pipe(gulp.dest('./build'));
    });