Glob / *不匹配以点开头的文件 [英] Glob /* does't match files starting with dot

查看:318
本文介绍了Glob / *不匹配以点开头的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  gulp.src(

使用gulp将所有文件从一个目录复制到另一个目录。 ['app / ** / *'])。pipe(gulp.dest('dist'));

全局文档说 * 匹配所有文件,但实际上名称以点开头的文件(如 .gitignore )不会被复制。



它怎么能如果你添加选项 dot:true ,它应该工作。例如:

  gulp.task('something',function(){
return gulp.src(['app / ** / *'],{
dot:true
})。pipe(gulp.dest('dist'));
});

参考资料


I'm using gulp to copy all files from one dir to another using code like this:

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

Glob docs say * match all files, but in fact files which have names starting with dot, like .gitignore, are not copied.

How can it be worked around?

解决方案

If you add the option dot: true, it should work. Eg:

gulp.task('something', function () {
    return gulp.src([ 'app/**/*' ], {
        dot: true
    }).pipe(gulp.dest('dist'));
});

Reference

这篇关于Glob / *不匹配以点开头的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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