-
-
Save sioniks/ff96f68890ff59c572d8189ce37b385b to your computer and use it in GitHub Desktop.
FTP Upload to remote server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var gulp = require('gulp'); | |
var gutil = require('gulp-util'); | |
var ftp = require('vinyl-ftp'); | |
var user = process.env.FTP_USER; | |
var pwd = process.env.FTP_PWD; | |
var localFiles = [ | |
'./assets/**/*', | |
'./*.ico', | |
'./*.js', | |
'./*.html' | |
]; | |
var remoteLocation = 'public_html/v2/'; | |
function getFtpConnection(){ | |
return ftp.create({ | |
host: enter_your_host_here, | |
port: 21, | |
user: user, | |
password: pwd, | |
parallel: 5, | |
log: gutil.log | |
}) | |
} | |
//deploy to remote server | |
gulp.task('remote-deploy',function(){ | |
var conn = getFtpConnection(); | |
return gulp.src(localFiles, {base: '.', buffer: false}) | |
.pipe(conn.newer(remoteLocation)) | |
.pipe(conn.dest(remoteLocation)) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment