Vinyl FTP upload specific directory

504 Views Asked by At

I'm trying to get Gulp Vinyl FTP to upload a specific Wordpress theme directory, here is the deploy command.

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' ) )
})

After I run the deploy command this is what it shows:

[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

However, none of the files in the theme directory get uploaded.

Any ideas what I'm doing wrong?

1

There are 1 best solutions below

0
On

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