我知道如何使用GULP任务FTP文件,唯一的问题是我不想要部署所有文件,让我说服务器上不需要的LESS文件,有人可以帮助我如何只上传css文件?
这是我的gulp任务
'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 ) )
;
});
答案 0 :(得分:0)
只需在glob
中排除less
个文件
var localFilesGlob = ['./**/*', '!./**/*.less'];