How to copy multiple files and keep the folder structure with Gulp

后端 未结 3 1492
谎友^
谎友^ 2020-12-22 23:20

I am trying to copy files from one folder to another folder using Gulp:

gulp.task(\'move-css\',function(){
  return gulp.src([
    \'./source/css/one.css\',
         


        
3条回答
  •  执笔经年
    2020-12-23 00:00

    I use gulp-flatten and use this configuration:

    var gulp = require('gulp'),
        gulpFlatten = require('gulp-flatten');
    
    var routeSources = {
      dist:  './public/',
      app: './app/',
      html_views: {
        path: 'app/views/**/*.*',
        dist: 'public/views/'
      }
    };
    
    gulp.task('copy-html-views', task_Copy_html_views);
    function task_Copy_html_views() {
      return gulp.src([routeSources.html_views.path])
          .pipe(gulpFlatten({ includeParents: 1 }))
          .pipe(gulp.dest(routeSources.html_views.dist));
    }
    

    And there you can see the documentation about gulp-flatten: Link

提交回复
热议问题