Glob/*与以点开头的文件不匹配

问题描述:

我正在使用gulp使用以下代码将所有文件从一个目录复制到另一个目录:

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文档说*匹配所有文件,但实际上不会复制名称以点开头的文件(例如.gitignore).

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

如何解决?

如果添加选项dot: true,它应该可以工作.例如:

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

参考