.htaccess - 使用 gulp 复制 .​​htaccess(一个点文件)失败

标签 .htaccess gulp file-copying

在 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 at a/.b/c. However the pattern a/*/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。

来自 node-glob documentation

关于.htaccess - 使用 gulp 复制 .​​htaccess(一个点文件)失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53945428/

相关文章:

php - 使用 htaccess 和 php 的 mp3 带宽限制

visual-studio-2015 - 通过在 Visual Studio 2015 中将绑定(bind)设置为 'After Build' 在任务运行器资源管理器中运行 gulp watch

vbscript - VBS 中的 CopyFile 权限被拒绝

html - 来自 background-image url 的图像 sprite,没有预处理器、mixins、watchers 等

windows - 为什么复制到 system32 会自动复制到 sysWOW64?

C# 如何在不改变原文件名的情况下复制文件

apache - 防止使用 .htaccess 直接下载 SQLite 文件

.htaccess - 用于 SSL 插入 index.php 的 Codeigniter .htaccess 文件

php - 是否可以区分使用 .htaccess 的图像热链接和常规链接?

javascript - Gulp Watch 不工作