How can I zip a folder in grunt?

I have a folder "foo", but in my target folder "target" I want to send zip version of my "foo" folder such as "foo.zip", I google and found many way for zipping files but not for folder, so how can we zip a whole folder in grunt ?

Answers


The accepted answer was throwing an error in grunt-contrib-compress 0.5.0. Try this instead:

compress: {
    foo: {
        options: {
            archive: './foo.zip',
            mode: 'zip'
        },
        files: [
            { src: './foo/**' }
        ]
    }
}

From above suggestion I am able to get my answer,We can use https://github.com/gruntjs/grunt-contrib-compress/ for zipping a folder.

compress: {
            zip:{ 
                  files: {
                            './foo.zip': './foo/**'
                         }
                }
          }

Need Your Help

Retrieve information about pre-processor directives

c++ serialization clang libclang

I've recently started using libclang to parse C files. The problem I'm having is that apparently, libclang initiates the preprocessor before generating AST. I would like to prohibit the preprocesso...

Find and replace with reordered date format in notepad++

regex date notepad++ replace

I have a file with a few thousand rows to be added to a MySQL database. There are date values in the rows which are in the dd-mm-yyyy format but I need them to be in the yyyy-mm-dd format.