Closed roytruelove closed 10 years ago
Could you elaborate more? What size are the files that you are zipping
? What do you mean by compression?
The full size of the 'bower' dir is about 500k, but the final zip is 16megs. When I unzip that 16m file, the result is only 500k. I've actually moved to grunt-contrib-compress for now since it's officially maintained by the grunt guys.
Would you mind telling me what projects are in your bower
directory so I can properly fix this?
They're mostly custom (it's proprietary unfortunately, so I can't send them to you.) There are some small .png files and other than that, text files (js, html, css, etc)
Alright, thanks.
Hi, i have the same problem. I have config like this:
zip:
dist:
cwd: 'dir'
src: ['**/*.*']
dest: 'target/dir.zip'
The 'dir' directory contains ~500kB of data (some images, html, js and css). The 'dir.zip' has around 60MB, but it contains only the files from the 'dir' directory. My whole project with all node_modules and all stuff has around 60 MB too, so it looks like the zip task is somehow using the root of my project to calculate the file size.
The size is probably a coincidence. I will take another look at this within the next week.
Okay, I have successfully reproduced the bug via https://gist.github.com/twolfson/8488728
It looks like grunt-zip
is including ..
in its zip which is causing this behavior.
To reiterate: This has not Windows specific and is reproducable on Linux.
Okay, so this is all confusion around the docs. cwd
is used only to route found files. It does not adjust the src
path that is used or where it searches.
In both cases, this means that it is finding all files specified in **/*
which is all files in the directory of the Gruntfile
.
@roytruelove your config can be corrected via
cwd: 'bower'
src: ['bower/**/*.*']
@Ludevik your config can be corrected via
cwd: 'dir'
src: ['dir/**/*.*']
I personally dislike the cwd
since both sides can argue whether it should/should not adjust the path. Unfortuantely, this is the current implementation and it is in the API so it will not be changed.
Instead of either, it is preferred to use router
.
Node v 0.10.13 grunt-zip 0.9.2
Plugin creates a 16meg file, but when compressed (and before compression), the size is about 500k.
Config: