Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional: Don't create an empty file #157

Open
Ulrikop opened this issue Apr 5, 2016 · 7 comments
Open

Optional: Don't create an empty file #157

Ulrikop opened this issue Apr 5, 2016 · 7 comments

Comments

@Ulrikop
Copy link

Ulrikop commented Apr 5, 2016

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.

@Lo5t
Copy link

Lo5t commented Apr 8, 2016

+1

@abelkius
Copy link

+ 1
@Ulrikop maybe you can create a pull request for this issue?

@tkambler
Copy link

tkambler commented Jun 1, 2016

I believe this PR solves this problem.

@abelkius
Copy link

abelkius commented Jun 2, 2016

@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.

@tkambler
Copy link

tkambler commented Jun 2, 2016

Ah, nevermind then.

@dennisfrank
Copy link

Yep. That would be useful. +1

@toptalo
Copy link

toptalo commented Oct 19, 2016

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants