简体   繁体   English

没有根文件夹的Grunt压缩

[英]Grunt Compress without root folder

I'm trying to compress a directory using grunt. 我正在尝试使用grunt压缩目录。 I have tried the following sections in my grunt file. 我在我的grunt文件中尝试了以下部分。

compress: {
    main: {
       options: {
           archive: 'dist/output.zip',
           mode: 'zip'
       },
       files: [{
           src: ['build/*'],
           cwd: 'build',
           expand: true
       }]
    }
}

which gives me an empty zip file. 这给了我一个空的zip文件。 Or 要么

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

which gives me the following structure in my zip file 这给了我在我的zip文件中的以下结构

output.zip
 - build
   - my files

but I would like to remove the build directory to get 但我想删除构建目录以获取

output.zip
 - my files

What changes can I make to get this structure? 我可以对这个结构做出哪些改变?

Have you tried: 你有没有尝试过:

compress: {
    main: {
       options: {
           archive: 'dist/output.zip',
           mode: 'zip'
       },
       files: [{
           src: ['**/*'],
           cwd: 'build/',
           expand: true
       }]
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM