0

我正在尝试让 Gulp Vinyl FTP 上传特定的 Wordpress 主题目录,这是部署命令。

gulp.task('deploy', function() {
    console.log('uploading to server');

    var conn = ftp.create({
        host: '',
        user: '',
        password: '',
        parallel: 3,
        log: gutil.log
    });

    var globs = [
    'wp-content/themes/theme2018/**/*',
    'wp-content/themes/theme2018/*',
        // '**/*',
        // '*',
        // '!node_modules/**',
        // '!node_modules/',
        // '!.env'
    ];

    return gulp.src( globs, { base: '.', buffer: false } )
            .pipe( conn.newer( '/public_html' ) ) // only upload newer files 
            .pipe( conn.dest( '/public_html' ) )
})

在我运行部署命令后,它显示的是:

[11:20:34] Using gulpfile D:\Cloud\Work\Website.com\gulpfile.js
[11:20:34] Starting 'deploy'...
uploading to server
[11:20:34] CONN
[11:20:35] READY
[11:20:35] MLSD  /public_html
[11:20:35] Finished 'deploy' after 786 ms

但是,没有上传主题目录中的文件。

任何想法我做错了什么?

4

1 回答 1

0

Add base options to newer

.pipe( conn.newer( '/public_html' ), { base: '.'} )

and u can use debug option when create ftp

const gutil = require( 'gulp-util' );
let conn = ftp.create({
    log:        gutil.log,
    debug:      gutil.log
});

And finaly, try 2 use dest insted newer

于 2018-04-27T08:34:33.517 回答