sindresorhus / gulp-zip

ZIP compress files
MIT License
270 stars 47 forks source link

dynamic filenames #54

Closed mrowdy closed 9 years ago

mrowdy commented 9 years ago

Is it possible to use the filename from gulp.src as filename for the generated archive?

I have a list of folders like this

packages
 - package-1
 - package-2
 - package-3

and want to generate:

build
 - package-1.zip
 - package-2.zip
 - package-3.zip

First problem:

if i provide *gulp.src('packages/')** it generates one zip file which contains all 3 folders. How can i split this into 3 separate zipfiles?

second problem:

zip('archive.zip') takes the filename as string. is there a way to provide the filename from gulp.src?

sindresorhus commented 9 years ago

This plugin just gathers up the files in the stream and zips them up. Keep in mind that gulp is just JS and you can do whatever you want with it. You could just loop through the packages directory, and create a new gulp.src stream for every subfolder. Then you already have the folder name that you could pass to zip.