Add break-line between files Grunt - concat

gruntjs, javascript, node.js

Solution

https://github.com/gruntjs/grunt-contrib-concat mentions the `separator` option and even gives a usage example for using a custom separator.

Here's their example:

grunt.initConfig({
  concat: {
    options: {
      separator: ';',
    },
    dist: {
      src: ['src/intro.js', 'src/project.js', 'src/outro.js'],
      dest: 'dist/built.js',
    },
  },
});

If that doesn't do it for you, you can probably change the `seapartor` line to:

separator: grunt.util.linefeed + ';' + grunt.util.linefeed;

Problem

I would like to know if there is a way to add a line between each file when we concat the files using Grunt concat. Because I get errors due to some inline comments in end of file which, when they are merged comments also the first line of the next file. A little tricky actually, I'm removing these comments manually but if I could avoid definitively this issue, could be better. Just add a line for each file concat could be great. I'll remove comments and spaces with Grunt - uglify next.

Original source