Closed Shawful closed 9 years ago
This is a duplicate of #22. To remove the dist/
while zipping, we can use the cwd
option to indicate that we want to copy the contents of dist/
but not dist/
itself:
{
zip: {
cwd: 'dist/',
src: '**/*',
dest: 'dist.zip'
}
}
I just realized that I need a different directory structure. Instead of moving all of the "goodies" up a folder level, I need to replace the dist folder with a folder of a different name, and keep the current structure, just with the "goodies" under this new folder's name once extracted. Is there a way to accomplish this? I appologize for the confusion. My understanding of the file folder structure that was needed for this project was incorrect.
Oh and thanks for the help, above. I wish the current working directory (cwd) and its use was explained more within the readme. Is it possible that the readme could be updated? I would fork the project and make the changes myself, but I'm probably going to be swamped today @ work. Well, that and I would probably miss something - since I'm just now coming to understand how to use it with the grunt-zip tool.
cwd
is explained in the documentation with an example:
https://github.com/twolfson/grunt-zip/tree/0.16.2#using-cwd
For the renamed folder case, you can:
new-folder
and use the original configuration you hadrouter
to dynamically rename the path (e.g. filepath.replace(/^dist/, 'new-folder')
)
I did get it to work, but I needed to modify src: '*_/ '
to src: 'dist/_*'
, instead of what you suggested above because this code allows me to grab only the files from my distribution folder and keep them at the top level of my .zip file.
Also, the suggestion above does not match the literature in the readme.md file. Using src: '**/*'
, will grab a lot of extra files that I do not need (outside of my distribution folder).
Also, I noticed that the readme.md file is missing a comma after cwd: 'nested/'
on the main github page. Would you please add this comma when you get a chance. I'm sure others will appreciate it.
Readme.md - (missing a comma after cwd: 'nested/')
I am created a yeoman project which I plan to zip and deploy to an AWS s3 bucket.
I'm taking everything within the 'dist' or distribution folder, zipping it up, and I've noticed that it does in fact create a *.zip file and place it in the correct destination path.
My problem is that when I upzip said *.zip file, it includes a 'dist' folder at the top of the folder tree and then beneath that folder are all of the compressed web files for the project, the goodies of the project.
I would like to place all of the compressed web files at the top level of the project, instead of being contained within the dist folder.
Is there a recommended way to accomplish this task?