Sharikov Vladislav
Sharikov Vladislav

Reputation: 7279

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

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?

Upvotes: 1

Views: 20

Answers (0)

Related Questions