How can I zip a folder in grunt (2018)

431 Views Asked by At

Referring to this post about grunt-contrib-compress: How can I zip a folder in grunt?

To this date when I try what they said was the fix, I receive this error:

Fatal error: path must be a string or Buffer.

Can anyone tell me what this means?

Here is what I have:

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

I also request if everything can be explained to a full extent.

1

There are 1 best solutions below

2
On

According to documentation of grunt-contrib-compress youre missing main level in your json

compress: {
    main: {
        options: {
            archive: './build.zip',
            mode: 'zip'
        },
        files: [
            { src: ['./build/**'], dest: 'ZipHere/'}
        ]
    }
}

Furthermore src should be an array.

Does it change anything?