Javascript 如何在 gulp 中获取可用任务列表

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30777032/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 05:43:22  来源:igfitidea点击:

How to get the available tasks list in gulp

javascriptnode.jsgulp

提问by vamsikrishnamannem

Hi Previously I used the gruntin that I want to know the available tasks use grunt --help. But same as in gulpuse gulp --helpit doesn't show. What is the command to know the available tasks list in gulp

嗨,以前我使用过grunt,因为我想知道可用的任务使用grunt --help. 但与gulp使用相同,gulp --help它没有显示。知道gulp中可用任务列表的命令是什么

回答by vamsikrishnamannem

Yes I got it use the gulp --tasksin command then it display the tasks list.

是的,我得到它使用gulp --tasksin 命令然后它显示任务列表。

回答by Vladimir Korshunov

gulp --tasks-simple

This command print a plaintext list of tasks. My local project:

此命令打印任务的纯文本列表。我的本地项目:

~ gulp --tasks-simple
clean
default

From gulp CLI documentation:

来自gulp CLI 文档

~ gulp --version
[03:00:05] CLI version 1.2.1
[03:00:05] Local version 4.0.0-alpha.2
~ gulp --help | grep 'tasks-simple'
  --tasks-simple   Print a plaintext list of tasks for the loaded gulpfile. [boolean]

回答by Mykhailo Stadnyk

Another possibility is to use gulp-help-docmodule, which provides possibility to print usage information based on jsDoc-like comments in a gulpfile. Currently it also supports TypeScript as well. The benefit is that you simply commenting your code without changing gulp API and you have usage info in command-line as well.

另一种可能性是使用gulp-help-doc模块,它提供了基于 gulpfile 中类似 jsDoc 的注释打印使用信息的可能性。目前它还支持 TypeScript。好处是您只需在不更改 gulp API 的情况下评论您的代码,并且您在命令行中也有使用信息。

回答by harishr

you can also use this plugin gulp-task-listing. It gives the main-tasksand sub-tasks list

你也可以使用这个插件gulp-task-listing。它给出了main-taskssub-tasks list

回答by Alexey Prokhorov

As an alternative you can write detailed documentation to your tasks in js comments using gulp-task-doc

作为替代方案,您可以使用gulp-task-doc在 js 注释中为您的任务编写详细文档

回答by marblewraith

There is no native command that does that but i use this pluginwith the following code:

没有执行此操作的本机命令,但我将此插件与以下代码一起使用:

module.exports.help = require('gulp-help')(gulp, {description : false});

I can then just run the default gulptask in the console and it'll display a list of tasks and definitions.

然后我可以gulp在控制台中运行默认任务,它会显示任务和定义的列表。