Skip to content

Possible to exclude archives that would be empty? #212

@Graham-Phillips

Description

@Graham-Phillips

My compress config creation function loops over many whitelabel folders, and creates zips of the assets it finds inside each white label:

var src = ['./asset/whitelabels/', '!.zip'];

grunt.file.expand({filter: 'isDirectory'}, module).forEach(function (dir) {

var compress = grunt.config.get('compress') || {};

	// set the config for this modulename-directory
	compress[dir] = {
		files:
				[
					{
						src: [
							dir + '**/graphics/**/*.png',
							dir + '**/core/**/*.mp3',

						]
					}
				],
		options:
				{
					archive: function () {
						return 'dist/' + dir.toLowerCase() + '.zip'
					}
				}
		};

	// save the new concat configuration
	grunt.config.set('compress', compress);
});

grunt.task.run('compress');

My problem is, if there were no assets within a particular whitelabel folder/subfolders, it creates an empty zip archive. I would like to skip the creation of empty archives, is it possible to specify that?
thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions