是否可以创建运行特定gulp任务的VS Code扩展? [英] Is it possible to create a VS Code extension that runs a specific gulp task?
问题描述
由于我是一个懒惰的程序员,所以我建立了一个gulp任务,可以为我完成一些次要任务,但是我想将其转换为扩展程序,以便可以将其安装在计算机上并且可以正常运行" .就像我安装它一样,启动VS代码,然后任务会执行并开始自动监视我的代码.
Since I'm a lazy programmer, I've built a gulp task that does some minor tasks for me but I'd like to turn this into an extension so I can install it on my computer and it just "works". Like I install it, boot up VS code and the tasks execute and start watching my code automatically.
我没有在网上找到很多东西,但是我又可能会搜索错误的东西.有什么帮助-谢谢!
I haven't found much things online but then again I could be googling the wrong things. Anything helps - thanks!
推荐答案
看看这对我有用:
// in tasks.json
{
"label": "Tasks: copy3",
"type": "shell",
"command": "gulp",
"args": [
"copy3",
"--file",
"${fileBasename}"
],
"problemMatcher": [],
"runOptions": {
"runOn": "folderOpen"
}
},
现在,打开该文件夹(或工作区)时,gulpfile.js中的copy3
任务将自动运行.您可能必须先在命令面板中选择Tasks: Allow Automatic Tasks in Folder
.并绝对重新加载.
Now the copy3
task in gulpfile.js will automatically be run when that folder (or workspace) is opened. You may have to select Tasks: Allow Automatic Tasks in Folder
first in the command palette. And definitely reload.
无扩展名-这是最近才内置的行为.请参见在打开的文件夹上运行任务
No extension - it is built-in behaviour more recently. See run task on folder open.
这篇关于是否可以创建运行特定gulp任务的VS Code扩展?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!