我正在使用grunt-contrib-compress压缩我的部署包。我有以下配置:
// Zip up the distribution folder and give it a build name. The folder can then be uploaded to the Chrome Web Store.
grunt.registerTask('compress-extension', 'compress the files which are ready to be uploaded to the Chrome Web Store into a .zip', function () {
// There's no need to cleanup any old version because this will overwrite if it exists.
grunt.config.set('compress', {
dist: {
options: {
archive: 'Streamus v' + grunt.option('version') + '.zip'
},
files: [{
src: ['dist/**'],
dest: '',
}]
}
});
grunt.task.run('compress');
});
这导致了我想避免的额外级别的目录结构。压缩后的结构如下:
'Streamus v0.xxx.zip' -> 'dist' -> '[sub directories]'
我希望只是:
'Streamus v0.xxx.zip' -> '[sub directories]'
这样做最简单的方法是什么?我可以在压缩的“文件”配置部分表达这种愿望吗?也许用扁平化?