Deploy to production server on shared hosting with gulp with FTP

Vinyl-ftp seems to work just fine, with the following additions to my gulpfile.js:

// ## Globals
var gutil        = require('gulp-util');
var ftp          = require('vinyl-ftp');

// ### Vinyl FTP
gulp.task('deploy', function() {
  var conn = ftp.create( {
    host:     '',
    user:     'username',
    password: 'password',
    parallel: 10,
    log:      gutil.log
  var globs = [
  // using base = '.' will transfer everything to /public_html correctly
  // turn off buffering in gulp.src for best performance
  return gulp.src( globs, { base: '.', buffer: false } )
    .pipe( conn.newer( '/public_html/web/app/themes/sage' ) ) // only upload newer files
    .pipe( conn.dest( '/public_html/web/app/themes/sage' ) );

// ### Build
// `gulp build` - Run all the build tasks but don't clean up beforehand.
// Generally you should be running `gulp` instead of `gulp build`.
gulp.task('build', function(callback) {
              ['fonts', 'images'],

Since the deploy task also runs on the gulp command, I had to manually exclude the static and maps files in the dist folder to prevent them from being uploaded.

1 Like