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

Don't create empty file #36

Closed
jasonkarns opened this issue Jul 15, 2013 · 4 comments
Closed

Don't create empty file #36

jasonkarns opened this issue Jul 15, 2013 · 4 comments

Comments

@jasonkarns
Copy link

If no source files are matched, prevent the creation of an empty destination file.

The nonull option is great if you want to error-out when src is empty, which is desirable for debugging situations. But it seems more reasonable (for non debug scenarios) to simply not create the destination file.

Creating an empty file (or file with nothing but banner) doesn't seem like it would ever be the expected result. The only two scenarios I would expect when src file(s) is empty are:

  1. error out (possible: just use nonull)
  2. silently do nothing (no input = no output)
@renege
Copy link

renege commented Dec 20, 2013

I'm getting an empty file after a concat. How to debug it?

@bogdan-kulynych
Copy link

@renege I have the same thing. Similarly, no idea.

@shama
Copy link
Member

shama commented Jan 7, 2014

I think this can be argued both ways. Some may have builds that conditionally include content and want empty files created; some, like yourself, would prefer not. With the current setup, you can use nonull: true and it will warn you when src files don't exist and not write the file.

For some precedence, cat idont exist > newfile will issue warnings that both idont and exist dont exist but still create an empty file named newfile. So I think the current operation is likely the most commonly expected behavior.

A workaround, would be to write a task that checks if given files are empty and delete them. Then put that task any place as needed.

grunt --verbose will list all the files it operates on. So either nonull: true or that can help @renege and @bogdan-kulynych debug.

@shama shama closed this as completed Jan 7, 2014
@akhoury
Copy link

akhoury commented Aug 22, 2014

I think this can be argued both ways

true. It sounds that both use cases are valid. could this be an independent option?

i.e: createEmptyFiles or dontCreateEmptyFiles (or whatever else in that sense)

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

5 participants