0

As a part of my Gruntfile.js:

...

concat: {

    ...

    js: {
        src: [
            'src/**/*.js'
        ],
        dest: 'build/js/main.js',
        nonull: true
    }
},

...

How can I prevent concat from generating a blank main.js if my src directory contains no scripts? Must I really create a separate task if I know I won't need to build any scripts?

tenub
  • 3,386
  • 1
  • 16
  • 25

1 Answers1

0

Not exactly a proper solution, but I managed to find a package called grunt-cleanempty which I set to run after concat to delete any generated empty files.

tenub
  • 3,386
  • 1
  • 16
  • 25
  • 1
    thats the only option you have! see this: https://github.com/gruntjs/grunt-contrib-concat/blob/master/tasks/concat.js#L111, the file is written, regardless on contents – hereandnow78 Sep 11 '14 at 19:08