Can you remove a folder structure when copying files in gulp?

Solution 1:

You could use gulp-rename to accomplish this:

var rename = require('gulp-rename');

gulp.src('app/client/**/*.html')
  .pipe(rename({dirname: ''}))
  .pipe(gulp.dest('dist'));

Solution 2:

You can use gulp-flatten https://www.npmjs.com/package/gulp-flatten

    app
    ├── logo
    │   └── logo.styl
    └── sidebar
        └── sidebar.styl
    
    var flatten = require('gulp-flatten');
    gulp.src('app/**/*.styl')
      .pipe(flatten())
      .pipe(gulp.dest('dist/'));
    
    dist
    ├── logo.styl
    └── sidebar.styl