【发布时间】:2019-01-04 23:54:10
【问题描述】:
我想将 Bower 组件的完整文件夹结构(没有第一级文件)复制到我的 Web 项目中。
源项目的结构如下所示:
bower_components/roboto-fontface-bower/css/
bower_components/roboto-fontface-bower/fonts/
bower_components/roboto-fontface-bower/.bower.json
bower_components/roboto-fontface-bower/bower.json
bower_components/roboto-fontface-bower/LICSENSE
bower_components/roboto-fontface-bower/package.json
bower_components/roboto-fontface-bower/README.md
我想获取文件夹css(包含文件)和fonts(包含文件)。
我当前的minimatch 模式是:
"bower_components/roboto-fontface-bower/**"
使用我当前的模式,文件.bower.json、bower.json 等也会被复制,这是我不想要的。我怎样才能只获取这两个文件夹(css & fonts)?
我尝试了"bower_components/roboto-fontface-bower/{css/,fonts/}",但这并没有复制任何内容。
【问题讨论】:
-
bower_components/roboto-fontface-bower/(css|fonts)/怎么样?不过我对 minimatch 不熟悉,所以也许这行不通。 -
感谢您的快速回答,但这根本没有复制
roboto-fontface-bower文件夹。 :'( -
我不确定迷你匹配是如何工作的,所以这可能不在我的范围内。使用这个正则表达式,应该返回 css 和 fonts 目录,这不是您所追求的还是还有更多?
标签: regex npm bower glob minimatch