Gulp.js 创建一个名称中带有版本后缀的 zip,但保留原始名称
Gulp.js create a zip with a version suffix in the name, but keep original name inside
我想弄清楚如何从带有版本后缀的文件夹中打包 zip 文件,但在提取存档时保留文件夹的原始名称。这是一个wp主题。所以 theme-1.5.0.zip
必须提取一个名为 theme
的文件夹。但是这段代码将其提取为 theme-1.5.0
gulp.task('make-zip', function () {
return gulp.src('build/theme/**')
.pipe(zip('theme-'+version+'.zip'))
.pipe(gulp.dest('build'))
});
当我在 finder 中手动压缩 theme
文件夹,然后将 theme.zip
重命名为 theme-1.5.0.zip
时,它实际上保留了原来的名称。但如果它是用 gulp.
压缩的
谢谢!
我自己 运行 进入这个问题。最终,我能够通过设置 src 的基本路径来使其工作。
gulp.task('make-zip', function () {
return gulp.src('build/theme/**', {base: "build"})
.pipe(zip('theme-'+version+'.zip'))
.pipe(gulp.dest('build'))
});
我想弄清楚如何从带有版本后缀的文件夹中打包 zip 文件,但在提取存档时保留文件夹的原始名称。这是一个wp主题。所以 theme-1.5.0.zip
必须提取一个名为 theme
的文件夹。但是这段代码将其提取为 theme-1.5.0
gulp.task('make-zip', function () {
return gulp.src('build/theme/**')
.pipe(zip('theme-'+version+'.zip'))
.pipe(gulp.dest('build'))
});
当我在 finder 中手动压缩 theme
文件夹,然后将 theme.zip
重命名为 theme-1.5.0.zip
时,它实际上保留了原来的名称。但如果它是用 gulp.
谢谢!
我自己 运行 进入这个问题。最终,我能够通过设置 src 的基本路径来使其工作。
gulp.task('make-zip', function () {
return gulp.src('build/theme/**', {base: "build"})
.pipe(zip('theme-'+version+'.zip'))
.pipe(gulp.dest('build'))
});