Closed mlaccetti closed 11 years ago
Unfortunately, this is expected behavior. Under the hood, cwd
creates a router via path.relative
. When router
is provided, we don't look for cwd
and continue.
The reason for this boils down to: If both cwd
and router
are provided, which is run first?
There are two possibilities and while one may have convention, I do not wish to muddy the waters by choosing a side. Each has an argument:
cwd
should be run first because all actions take place in the working directory.router
should be run first since I am routing a nested file hierarchy to a flattened one and need cwd
after that.I will add an assert
in the code and update the README
to warn people appropriately.
As for yourself, you have a couple of options:
router
to return path.relative
Thumbs.db
, you can use minimatch
to ignore the file (available in grunt>=0.4
){
'grunt-zip': {
// Whitelist format
app: {
src: ['app/js/**/*', 'app/bork.html'],
dest: 'app.zip'
},
// Blacklist format
app2: {
src: ['app/**/*', '!app/Thumbs.db'],
dest: 'app2.zip'
}
}
}
http://gruntjs.com/configuring-tasks#globbing-patterns
https://github.com/isaacs/minimatch#comparisons-to-other-fnmatchglob-implementations
Released assert
and README.md
updates in 0.9.1
.
Thanks for the detailed info and the solution - I'll migrate to using that. :+1:
Seems that when you use
cwd
and therouter
the path still shows up in the zip.If I have:
If I put a router to ignore Thumbs.db and use
cwd: 'app'
I'll get app/... (minus Thumbs.db).