Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dest is ignored when archive type is zip #71

Closed
nerdgore opened this issue Nov 26, 2013 · 2 comments
Closed

dest is ignored when archive type is zip #71

nerdgore opened this issue Nov 26, 2013 · 2 comments

Comments

@nerdgore
Copy link

In the examples you provide, a dest option is set for each file:

// make a zipfile
compress: {
  main: {
    options: {
      archive: 'archive.zip'
    },
    files: [
      {src: ['path/*'], dest: 'internal_folder/', filter: 'isFile'}, // includes files in path
      {src: ['path/**'], dest: 'internal_folder2/'}, // includes files in path and its subdirs
      {expand: true, cwd: 'path/', src: ['**'], dest: 'internal_folder3/'}, // makes all src relative to cwd
      {flatten: true, src: ['path/**'], dest: 'internal_folder4/', filter: 'isFile'} // flattens results to a single level
    ]
  }
}

However, setting dest has absolutely no effect.
If one wants to compress the contents of target/ to target/<%= pkg. name %> the path has to be defined in archive rather than dest.

Working configuration:

config.compress = {
    dist: {
        options: {
            archive: "target/<%= pkg.name %>.zip"
        },
        files: [
            {
                src: ["target/<%= pkg.name %>/**"]
            }
        ]
    }
};
@ctalkington
Copy link
Member

the example is correct, in that it says "internal_folder", ie relative to inside of archive. it works this way as archives are only meant to be singular per each grunt multi-task target. thus all your file dests are going to be relative to inside of the resulting archive. it would be a nightmare to support multiple archives in a single target and the way it works flows with grunts concept of multi-task targets.

EDIT sorry for the misunderstanding and multiple semi-unrelated posts.

@cniaulin
Copy link

It did not seems obvious to me in fact, I fall exactly in the same trap and loose a lot of time on this trying to understand what was wrong or what property to modify in order to get the job done.
Finally after many many tries, I had to read this thread to find out what was wrong.
Examples are not really explicit and it is no error message.
I guess that an improved documentation would avoid those misunderstandings.

@tkellen tkellen closed this as completed Feb 14, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants