diff --git a/gulpconfig.js b/gulpconfig.js index 087d560..3ac7685 100644 --- a/gulpconfig.js +++ b/gulpconfig.js @@ -141,6 +141,15 @@ module.exports = { }, }, + ftp: { + dest: '/public_html/domain.com/wp-content/themes/'+project, + dist: dist, + parallel: 3, + host: 'domain.com', + user: 'user@domain.com', + password: 'password' + }, + watch: { // What to watch before triggering each specified task; if files matching the patterns below change it will trigger BrowserSync or Livereload src: { styles: src+'scss/**/*.scss', diff --git a/gulpfile.js/tasks/ftp.js b/gulpfile.js/tasks/ftp.js new file mode 100644 index 0000000..f28cda8 --- /dev/null +++ b/gulpfile.js/tasks/ftp.js @@ -0,0 +1,30 @@ +// ==== FTP ==== // + +var gulp = require('gulp'), + gutil = require( 'gulp-util' ), + ftp = require ('vinyl-ftp'), + config = require('../../gulpconfig').ftp; + +// Copy PHP source files to the `build` folder +gulp.task( 'deploy', function () { + + var conn = ftp.create( { + host: config.host, + user: config.user, + password: config.password, + parallel: config.parallel, + log: gutil.log + } ); + + var globs = [ + config.dist+'/**/*' + ]; + + // using base = '.' will transfer everything to /public_html correctly + // turn off buffering in gulp.src for best performance + + return gulp.src( globs, { base: config.dist, buffer: false } ) + .pipe( conn.differentSize( config.dest ) ) // only different sized files + .pipe( conn.dest( config.dest ) ); + +} ); \ No newline at end of file diff --git a/package.json b/package.json index 2077639..336cee8 100644 --- a/package.json +++ b/package.json @@ -49,6 +49,7 @@ "spin.js": "^2.3.2", "svg4everybody": "^2.1.0", "timeago": "^1.5.3", + "vinyl-ftp": "^0.6.0", "wp-ajax-page-loader": "^0.3.0" }, "scripts": {