grunt-contrib-concat
grunt-contrib-concat copied to clipboard
Optional: Don't create an empty file
Hi, I've got the issue, that the conncat task creats a file, although no source file was found. At my case, I want to prevent that.
I looked for an option to disable that feature. I haven't found one. But I found the request #36 from 2013. akhoury asked for the createEmptyFiles option but no one answered. Since I am not sure if the idea was lost because the issue has already been closed, I create a new one to ask for it.
Do you can offer an option like createEmptyFiles: true/false?
To implement it, you must only do that change on line 114 at concat.js:
if (!options.createEmptyFiles &&/^\s*$/.test(src)) {
grunt.verbose.write('No content available.')
}
else {
grunt.file.write(f.dest, src);
grunt.verbose.write('File ' + chalk.cyan(f.dest) + ' created.');
}
Thank you.
+1
+ 1 @Ulrikop maybe you can create a pull request for this issue?
I believe this PR solves this problem.
@tkambler not exactly, if I understood correctly the PR you are talking about just warn or throws an error if the source file is empty.
The problem described here is: not to create an empty file (if no src files supplied or they are empty), but also not to throw the error which would break the task.
Ah, nevermind then.
Yep. That would be useful. +1
:+1: