basickarl
basickarl

Reputation: 40464

gulp: acquire filename of file being passed

How does one acquire the filename of the file being passed in gulp-jshint?

Upvotes: 3

Views: 2521

Answers (1)

harishr
harishr

Reputation: 18055

gulp-tap would help you print the names of files being used from 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'));
    });

Upvotes: 3

Related Questions