Get the current file name in gulp.src()

后端 未结 6 736
温柔的废话
温柔的废话 2020-11-28 21:57

In my gulp.js file I\'m streaming all HTML files from the examples folder into the build folder.

To create the gulp task is not difficult:

6条回答
  •  有刺的猬
    2020-11-28 22:37

    For my case gulp-ignore was perfect. As option you may pass a function there:

    function condition(file) {
     // do whatever with file.path
     // return boolean true if needed to exclude file 
    }
    

    And the task would look like this:

    var gulpIgnore = require('gulp-ignore');
    
    gulp.task('task', function() {
      gulp.src('./**/*.js')
        .pipe(gulpIgnore.exclude(condition))
        .pipe(gulp.dest('./dist/'));
    });
    

提交回复
热议问题