mercredi 25 mars 2015

Gulp and FTP : How to transfer only the content of a folder?


Gulp with vinyl ftp : how to specify different directory name? I am using vinyl-ftp with gulp to push my local dist/ directory to remote production server.


Thing is my local ready-to-production directory name is "dist", and I want all of its content to be pushed in a "www" directory on the server.


The code is :



gulp.task( 'deploy:prod', ['build:dist'], function() {

var conn = ftp.create( {
host: 'ftp.website.com',
user: 'username',
password: 'password'
} );

var globs = ['./dist/**'];

return gulp.src( globs, {base: '.', buffer: false } )
.pipe( conn.differentSize( 'www/' ) )
.pipe( conn.dest( 'www/' ) );
} );


As you see, I'm trying to get only the content of dist/ by targeting './dist/**', but after transfer is done, the path I get is : /www/dist/.


One workaround would be to rename my "dist/" folder to "www/" and then set vinyl ftp's destination to server ROOT, but I'd prefer to keep concerns separated and keep the name "dist/" for my local build.


Do you have any ideas on how to have the content of my local dist/ folder transferred into the remote www/ folder ?





Aucun commentaire:

Enregistrer un commentaire