Best way to compress a directory to tar.gz with Grunt

283 views Asked by At

I am trying to compress a directory to a .tar.gz with Grunt using "grunt-tar.gz" doing this:

targz: {
            standalone_win: {
                files: {
                    "./target/dir":  "./target/dir.tgz"
                }
            }
        }

However, it gives me an error because the source file './target/dir.tgz' is not found. Are there other ways to do this using grunt-shell or grunt-contrib-compress? What is the best way?

1

There are 1 answers

0
YourReflection On

Did it with grunt-contrib-compress:

compress {
     tarGz: {
                options: {
                    archive: './target/dir.tgz'
                },
                files: [{
                    cwd: './target/someDirToCompress',
                    expand: true,
                    src: './**',
                    dest: './'
                }]
     }
}