我在 gulp 中有以下任务:
gulp.task('sync-frontend', /*['build-frontend'],*/ function()
{
if(config.layout.frontend.syncOnBuild)
return gulp
.src(config.layout.frontend.distDir + '/**')
.pipe(changed(config.layout.frontend.distDir, {hasChanged: changed.compareSha1Digest}))
//.pipe(debug())
.pipe(gulp.dest(config.layout.frontend.distDir))
.pipe(sftp
({
host: config.sftp.host,
port: config.sftp.port,
user: config.sftp.user,
pass: config.sftp.pass,
remotePath: (config.layout.frontend.remotePath ? config.layout.frontend.remotePath : config.sftp.remotePath )
}));
});
config.layout.frontend.distDir 值为“httpdocs”。
问题是没有文件被上传,无论它们是否被更改(我已经尝试将 gulp-changed 的 hasChange 选项保留为默认值。我总是得到以下输出:
[20:45:52] Using gulpfile /Storage/Portable/Sync/Projects/Prataria/web-prataria/gulpfile.js
[20:45:52] Starting 'sync-frontend'...
[20:45:52] gulp-sftp: No files uploaded
[20:45:52] Finished 'sync-frontend' after 503 ms
有任何想法吗?