Gulp ftp 部署。没有 src 目录
Gulp ftp deploy. Without src directory
我想弄清楚当 gulp 在 ftp 服务器上部署 dist 时如何在没有 src
目录的情况下发送文件。
我的配置:
var gutil = require( 'gulp-util' );
var ftp = require( 'vinyl-ftp' );
gulp.task( 'deploy', function() {
var conn = ftp.create( {
host: 'hydrogen',
user: 'hosting',
password: 'test',
parallel: 10,
log: gutil.log
} );
var globs = [
'src/**',
'css/**',
'js/**',
'fonts/**',
'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( '/projects/test' ) ) // only upload newer files
.pipe( conn.dest( '/projects/test' ) );
} );
所以,部署后我得到 projects/test/src
路径。我想获取没有 src
目录的文件或重命名它。
尝试使用 flatten 从文件中删除路径信息。
我想弄清楚当 gulp 在 ftp 服务器上部署 dist 时如何在没有 src
目录的情况下发送文件。
我的配置:
var gutil = require( 'gulp-util' );
var ftp = require( 'vinyl-ftp' );
gulp.task( 'deploy', function() {
var conn = ftp.create( {
host: 'hydrogen',
user: 'hosting',
password: 'test',
parallel: 10,
log: gutil.log
} );
var globs = [
'src/**',
'css/**',
'js/**',
'fonts/**',
'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( '/projects/test' ) ) // only upload newer files
.pipe( conn.dest( '/projects/test' ) );
} );
所以,部署后我得到 projects/test/src
路径。我想获取没有 src
目录的文件或重命名它。
尝试使用 flatten 从文件中删除路径信息。