在gulp中复制文件时可以删除文件夹结构吗? [英] Can you remove a folder structure when copying files in gulp?

查看:127
本文介绍了在gulp中复制文件时可以删除文件夹结构吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我使用:

If I use :

 gulp.src(['app/client/**/*.html'])
  .pipe(gulp.dest('dist'));

我的 .html 文件被保存在 dist 文件夹中,但是我想完全删除文件夹结构,并且在我的 dist folder。

The folder structure in which my .html files were in, is maintained in the dist folder, but I would like to remove the folder structure completely and just a flat hierarchy in my dist folder.

推荐答案

您可以使用 gulp-rename 完成此操作:

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'));

这篇关于在gulp中复制文件时可以删除文件夹结构吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆