0

I know how to FTP files using GULP task, only problem i have is that I dont want all files to be deployed, lets say LESS files i dont need on server, can someone help me how to only uplaod css files??

here is my gulp task

   '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 ) )
    ;
});
Miomir Dancevic
  • 6,726
  • 15
  • 74
  • 142
  • Possible duplicate of [Excluding files/directories from Gulp task](http://stackoverflow.com/questions/23384239/excluding-files-directories-from-gulp-task) – Sven Schoenung Jun 29 '16 at 12:41

1 Answers1

0

Just exclude less files in the glob

var localFilesGlob = ['./**/*', '!./**/*.less'];  
lofihelsinki
  • 2,491
  • 2
  • 23
  • 35