Get the current file name in gulp.src()
I'm not sure how you want to use the file names, but one of these should help:
If you just want to see the names, you can use something like
gulp-debug
, which lists the details of the vinyl file. Insert this anywhere you want a list, like so:var gulp = require('gulp'), debug = require('gulp-debug'); gulp.task('examples', function() { return gulp.src('./examples/*.html') .pipe(debug()) .pipe(gulp.dest('./build')); });
Another option is
gulp-filelog
, which I haven't used, but sounds similar (it might be a bit cleaner).Another options is
gulp-filesize
, which outputs both the file and it's size.If you want more control, you can use something like
gulp-tap
, which lets you provide your own function and look at the files in the pipe.
I found this plugin to be doing what I was expecting: gulp-using
Simple usage example: Search all files in project with .jsx extension
gulp.task('reactify', function(){
gulp.src(['../**/*.jsx'])
.pipe(using({}));
....
});
Output:
[gulp] Using gulpfile /app/build/gulpfile.js
[gulp] Starting 'reactify'...
[gulp] Finished 'reactify' after 2.92 ms
[gulp] Using file /app/staging/web/content/view/logon.jsx
[gulp] Using file /app/staging/web/content/view/components/rauth.jsx