Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

In order to retrieve the name of the file that is currently in use in gulp.src(), you can use the gulp-debug plugin. This plugin will log the name of each file as it passes through the gulp stream.

Here's an example of how to use the gulp-debug plugin:

const gulp = require('gulp');
const debug = require('gulp-debug');

gulp.task('myTask', function() {
  return gulp.src('src/*.js')
    .pipe(debug({title: 'File: '}))
    .pipe(gulp.dest('dist/'));
});

In this example, the gulp.src() function is used to select all JavaScript files in the "src" directory. Then, the gulp-debug plugin is used to log the name of each file as it passes through the stream. Finally, the files are output to the "dist" directory using the gulp.dest() function.

The output in the console will show the name of each file as it is processed, prefixed with the string "File: ":

[17:22:51] File: app.js
[17:22:51] File: main.js
[17:22:51] File: plugin.js