Is it possible to not create output zip if there are no files in specified paths when using grunt-contrib-compress?

27 Views Asked by At

I have this target:

module.exports = function (grunt, config) {
  var path = require('path'),
    zipOutputPath = /*getOutputPath*/,
    someOptions = /*getOptions*/;

  return {
    options: someOptions,
    myTarget: {
      options: {
        archive: zipOutputPath + path.join + 'zipName.zip'
      },
      files: [
        {
          src: ['test-reports/**']
        },
        {
          src: ['*.xml']
        }
      ]
    }
  };
};

Imagine there are no files in test-reports/** path and no xml files in cwd. In this after running grunt compress:myTarget grunt-contrib-compress will create empty zip archive with name zipName at zipOutputPath.

Is it somehow possible to not create zip archive if there were no files in specified places? Maybe there is some option or any workaround available?

0

There are 0 best solutions below