Introduction:
Here i am going to explain how to move your files to ftp using gulp.
Step 1 :
Install necessary gulp required files.
Install gulp-util and gulp-ftp
Here i am going to explain how to move your files to ftp using gulp.
Step 1 :
Install necessary gulp required files.
Install gulp-util and gulp-ftp
- var gutil = require('gulp-util');
- var ftp = require('gulp-ftp');
Step 2: How to install gulp packages:
Go to your command prompt and your Gulp directory
F:\gulpdir\npm install --save gulp-util
F:\gulpdir\npm install --save gulp-ftp
And then add this code to your gulfile.js
- gulp.task('deploy', function () {
- var conn = ftp.create({
- host: '192.168.3.5', // your ftp address
- user: 'username', //Ftp user name
- password: 'Password', //Ftp Password
- parallel: 10,
- log: gutil.log
- });
- var globs = [
- 'src/**', //Your source files
- 'index.html'
- ];
- // 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')) // only upload newer files
- .pipe(conn.dest('/public_html')); //Destination folder
- });
- gulp.task('default', function (done) {
- runSequence( 'deploy', done);
- });
No comments:
Post a Comment