"gulp ftp to site" Code Answer's
You're definitely familiar with the best coding language Whatever that developers use to develop their projects and they get all their queries like "gulp ftp to site" answered properly. Developers are finding an appropriate answer about gulp ftp to site related to the Whatever coding language. By visiting this online portal developers get answers concerning Whatever codes question like gulp ftp to site. Enter your desired code related query in the search bar and get every piece of information about Whatever code related question on gulp ftp to site.
gulp ftp to site
'use strict'
var gulp = require('gulp')
var gutil = require('gulp-util')
var ftp = require('vinyl-ftp')
/** Configuration **/
var user = process.env.FTP_USER
var password = process.env.FTP_PWD
var host = 'your hostname or ip address'
var port = 21
var localFilesGlob = ['./**/*']
var remoteFolder = '/myApp'
// helper function to build an FTP connection based on our configuration
function getFtpConnection() {
return ftp.create({
host: host,
port: port,
user: user,
password: password,
parallel: 5,
log: gutil.log,
})
}
/**
* Deploy task.
* Copies the new files to the server
*
* Usage: `FTP_USER=someuser FTP_PWD=somepwd gulp ftp-deploy`
*/
gulp.task('ftp-deploy', function() {
var conn = getFtpConnection()
return gulp
.src(localFilesGlob, { base: '.', buffer: false })
.pipe(conn.newer(remoteFolder)) // only upload newer files
.pipe(conn.dest(remoteFolder))
})
/**
* Watch deploy task.
* Watches the local copy for changes and copies the new files to the server whenever an update is detected
*
* Usage: `FTP_USER=someuser FTP_PWD=somepwd gulp ftp-deploy-watch`
*/
gulp.task('ftp-deploy-watch', function() {
var conn = getFtpConnection()
gulp.watch(localFilesGlob).on('change', function(event) {
console.log(
'Changes detected! Uploading file "' + event.path + '", ' + event.type
)
return gulp
.src([event.path], { base: '.', buffer: false })
.pipe(conn.newer(remoteFolder)) // only upload newer files
.pipe(conn.dest(remoteFolder))
})
})
Source: loige.co
All those coders who are working on the Whatever based application and are stuck on gulp ftp to site can get a collection of related answers to their query. Programmers need to enter their query on gulp ftp to site related to Whatever code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about gulp ftp to site for the programmers working on Whatever code while coding their module. Coders are also allowed to rectify already present answers of gulp ftp to site while working on the Whatever language code. Developers can add up suggestions if they deem fit any other answer relating to "gulp ftp to site". Visit this developer's friendly online web community, CodeProZone, and get your queries like gulp ftp to site resolved professionally and stay updated to the latest Whatever updates.