Glob /* doesn't match files starting with dot

2019-03-17 21:37发布

问题:

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?

回答1:

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



标签: gulp glob