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

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

问题描述

如果我使用:

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

我的 .html 文件所在的文件夹结构在 dist 文件夹中维护,但我想完全删除文件夹结构,只是一个平面我的 dist 文件夹中的层次结构.

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天全站免登陆