[英]gulp-rsync on Windows not Making Directory on Remote Linux Server
I've gotten the following gulp task to transfer files from a Windows 10 machine to a remote Linux server. 我已经完成了以下任务,将文件从Windows 10计算机传输到远程Linux服务器。 However, files are being copied with a backslash "\\" vice forward slash "/" resulting in long file names like "js\\myjs.js" instead of creating a folder called "js" with "myjs.js" in it.
但是,将使用反斜杠“ \\”反斜杠“ /”复制文件,导致文件名较长,例如“ js \\ myjs.js”,而不是在其中创建带有“ myjs.js”的名为“ js”的文件夹。 I haven't found an option or switch to fix the problem.
我还没有找到解决该问题的选项或开关。 Any ideas what I'm doing wrong?
有什么想法我做错了吗?
gulp.task('deploy', function() {
return gulp.src('dist/*/')
.pipe(rsync({
options: {
chmod: 'ugo=rwX',
'r': true,
'v': true,
'delete': true,
'verbose': true,
'progress': true
},
username: "user",
password: "pass",
hostname: 'host.com',
destination: '~/test/',
recursive: true,
clean: true,
root: "dist/"
}));
});
This problem and the solution is described here as follows: 这个问题和解决方案被描述这里如下:
In gulp-rsync index.js change:
在gulp-rsync index.js中进行更改:
source: sources.map(function(source) {
return path.relative(cwd, source.path) || '.';
}),
to:
至:
source: sources.map(function(source) {
var file_path = (path.relative(cwd, source.path) || '.').replace( /\\/g, '/')
// console.log( 'gulp-rsync source:', source.path, ', ret: ', file_path );
return file_path
}),
path.relative() is the culprit.
罪魁祸首是path.relative()。
There is already a stcruy's fork of gulp-rsync solving this. gulp -rsync已经解决了这个问题。 To deploy it, do the following:
要部署它,请执行以下操作:
npm remove -D gulp-rsync
npm install -D https://github.com/stcruy/gulp-rsync.git
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.