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: 'ftp.mydomain.com',
user: 'username',
password: 'password',
parallel: 10,
log: gutil.log
});
var globs = [
'*',
'*.php',
'dist/**',
'lang/**',
'templates/*.php',
'lib/*.php',
'!.git',
'!*.json',
'!*.md',
'!*.xml',
'!assets',
'!bower_components',
'!dist/scripts/jquery.js',
'!dist/scripts/jquery.js.map',
'!dist/scripts/main.js',
'!dist/scripts/main.js.map',
'!dist/scripts/modernizr.js',
'!dist/scripts/modernizr.js.map',
'!dist/styles/editor-style.css',
'!dist/styles/editor-style.css.map',
'!dist/styles/main.css',
'!dist/styles/main.css.map',
'!gulpfile.js',
'!node_modules',
'!node_modules/**',
];
// 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) {
runSequence('styles',
'scripts',
['fonts', 'images'],
'deploy',
callback);
});
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.