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

add displayName support to exported tasks #53

Merged
merged 1 commit into from
Jan 29, 2016
Merged

Conversation

nmn
Copy link
Contributor

@nmn nmn commented Jan 2, 2016

I can't find the exact place with the documentation, but I read somewhere that the task name can be be set using the displayName property on the function. The description property is already working correctly. And displayName is handled correctly elsewhere, (e.g. gulp.parallel)

This small change should fix this.

I can't find the exact place with the documentation, but I read somewhere that the task name can be be set using the displayName property on the function. The description property is already working correctly. And displayName is handled correctly elsewhere, (e.g. gulp.parallel)

This small change should fix this.
@terinjokes
Copy link

You're probably looking for this in the docs: https://github.com/gulpjs/gulp/blob/4.0/docs/API.md#name

@nmn
Copy link
Contributor Author

nmn commented Jan 2, 2016

Yup!

@phated
Copy link
Member

phated commented Jan 29, 2016

Can you give me a real world scenario for this? I'm also including @thejameskyle to see if there is anything I might be missing on this.

@jamiebuilds
Copy link

I'm not aware of any reason you'd want to do this. I can see the case for displayName for gulp.task tasks if you're doing something dynamically and can't set the function.name, but you can't have dynamic ES exports anyways, so I don't see what this helps.

@phated
Copy link
Member

phated commented Jan 29, 2016

@thejameskyle can you do something like css:prod as the export name? A lot of people do that for some reason, which is why we support displayName with gulp.task

@jamiebuilds
Copy link

Ah, no you cannot. The export name needs to be an identifier just like a function name.

@nmn
Copy link
Contributor Author

nmn commented Jan 29, 2016

The idea is pretty simple. gulp-cli already shows the displayName in many cases. This mostly just makes everything more consistent.

In general, I believe using function.name for the name of the task is a great solution, but as mentioned above often you wanna use hyphens or colons in your task names, and displayName would come in handy in that case.

Also, just to make it clear, this PR has nothing to do with dynamic exports or anything like that. Just slightly more consistent self documentation.

phated added a commit that referenced this pull request Jan 29, 2016
add displayName support to exported tasks
@phated phated merged commit e8a7950 into gulpjs:master Jan 29, 2016
@nmn nmn deleted the patch-1 branch January 29, 2016 22:10
@phated
Copy link
Member

phated commented Feb 9, 2016

Backing out this change due to it breaking export const dist = series(clean, css); which is a more valid use case than using displayName to export things like css:dist. Also going to write some regression tests and publish as 1.2.1

@nmn
Copy link
Contributor Author

nmn commented Feb 9, 2016

tricky...

phated added a commit that referenced this pull request Dec 21, 2017
add displayName support to exported tasks
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

Successfully merging this pull request may close these issues.

5 participants