Grunt JS复制到网络位置

Ser*_*pov 12 copy gruntjs

我想使用grunt-contrib-copy(或任何其他grunt复制插件)将文件复制到网络位置.

尝试以下:

    copy: {
        test: {
            files: [
                { src: ['Scripts/*'], dest: ['\\\\location\\site\\Scripts\'] }
            ]
        }
    }
Run Code Online (Sandbox Code Playgroud)

但得到:

警告:无法写入"\\ location\site\Scripts \"文件(错误或代码:未定义).使用--force继续.

有可能/如何复制到网络位置?

All*_*sen 12

是的,这很简单,只需用正斜杠定义你的路径:

copy: {
     test: {
         files: [
             { src: ['Scripts/*'], dest: ['//location/site/Scripts/'] }
         ]
     }
}
Run Code Online (Sandbox Code Playgroud)

这也适用于Windows,grunt会照顾它.试试看.

  • 这在某些 mac 上失败并显示以下错误:`Running "copy" (copy) task Warning: Unable to create directory "/location" (Error code: EACCES)。使用 --force 继续。` (2认同)