Flatten glob down to one directory

后端 未结 3 1638
太阳男子
太阳男子 2020-12-09 08:19

Within Gulp, I am using gulp.src to select every font file from a directory:

gulp.task(\'copy-fonts\', function() {
   gulp.src(\'components/**/         


        
3条回答
  •  情书的邮戳
    2020-12-09 08:48

    I would use gulp-flatten:

    var flatten = require('gulp-flatten');
    gulp.task('copy-fonts', function() {
      gulp.src('dependencies/**/*.{ttf,woff,eof,svg}')
      .pipe(flatten())
     .pipe(gulp.dest('build/fonts'));
    });
    

    As to how this is done internally, check: https://github.com/armed/gulp-flatten/blob/master/index.js

提交回复
热议问题