The vinyl-ftp
package has a function clean()
but I'm not sure how to use it right. I need to:
- get all files from my
build
folder - put them into the target folder on my ftp server
- clean files if they're not available locally
I have the following gulp task:
gulp.task('deploy', () => {
let conn = ftp.create({host:host,user:user,password: password});
return gulp.src('build/**', {base: './build/', buffer: false })
.pipe(conn.newer('/path/on/my/server/')) // only upload newer files
.pipe(conn.dest('/path/on/my/server/'))
.pipe(conn.clean('build/**', './build/'));
});
1) and 2) is OK, but the clean()
function does nothing
The
vinyl-ftp
docs have this to say:Note that
globs
expects a path for the remote files on your FTP server. Since your remote files are located in/path/on/my/server/
you have to specify that path as your glob: