Closed davibennun closed 11 years ago
Hey @DaviBenNun , indeed it can! There are 2 options which you can use to accomplish this:
cwd
{
cwd: 'dev/',
src: ['dev/**/*'],
dest: 'dev.zip'
}
router
{
src: ['dev/**/*'],
dest: 'dev.zip',
router: function (filepath) {
return filepath.replace('dev/', '');
}
}
More information on these options can be found in the README. Thanks!
Hello @twolfson thank you so much for your answer. I just tried both suggestions but it didn't worked out, the destination zip contained one folder called "dev" and inside it was all the content, as I said the goal is to have the content directly in the root of the zip file, I have been playing with cwd and router variations but I just can't make it work...
Alright, I cannot take a look now but I should be able to make a proof of concept this weekend.
@DaviBenNun I implemented the cwd
solution and the zip file does not have the dev/
folder in it as expected. Here is my proof of concept, you can clone it, npm install
, and grunt
to find the same .zip
that I am viewing.
I have the following directory structure, and I want zip the content of dev without it being wrapped inside a root folder:
Here is the code:
I wish I could zip only the contents of dev folder and place it into dist folder. But when I try to do so I, all the content of dev are zipped inside a root folder.
Actual generated zip:
But I want the zip file to be like this:
You see? the files are being wrapped in a folder(with the same name as the zip) instead of beeing place into the root of zip file.
Can this be achieved in some way?