在 gulp 任务中,我尝试复制构建文件夹中的文件。
gulp.task( addon, function() {
var a_addon_function = addon.split("_") ;
var addon_dirname = a_addon_function[1];
var dest_path = ( options.env === "tests" || ( options.env === "dist" && options.type === "premium" ) ) ? build_path + addon_dirname + "/" + addon_dirname : build_path + addon_dirname;
return gulp.src( [ "./plugins/addons/" + addon_dirname + "/**/*", "./plugins/_common/**/*", "./plugins/addons/_common/**/*" ] )
.pipe( gulp.dest( dest_path )
);
});
文件 .htaccess
永远不会被复制。为什么 ?如何解决这个问题?
最佳答案
Dots
If a file or directory path portion has a . as the first character, then it will not match any glob pattern unless that pattern's corresponding path part also has a . as its first character.
For example, the pattern
a/.*/c
would match the file ata/.b/c
. However the patterna/*/c
would not, because*
does not start with a dot character. You can make glob treat dots as normal characters by setting dot:true in the options.
设置选项:
gulp.src('...…….', { dot: true })
这样点就可以像其他任何字符一样被处理了。然后你应该可以使用原来的 gulp.src。
关于.htaccess - 使用 gulp 复制 .htaccess(一个点文件)失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53945428/