I try to generate multiple zip files with gulp-zip
packages
- package-1
- package-2
to
build
- package-1.zip
- package-2.zip
At the moment my task looks like this:
gulp.task('zip', function () {
return gulp.src("packages/*")
.pipe(zip("archive.zip"))
.pipe(gulp.dest("build"));
});
This generates a single zip file names archive.zip which contains my two packages.
How to get 2 separate zipfiles?
How to pass the folder name to the zip function?
You can call the zip command twice in your zip task, like so:
gulp.task('zip', function () {
gulp.src("packages/package-1/**")
.pipe(zip("archive-1.zip"))
.pipe(gulp.dest("build"));
return gulp.src("packages/package-2
.pipe(zip("archive-2.zip"))
.pipe(gulp.dest("build"));
});
This will result in 2 zip-files in your build folder. Hope this helps.