0

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!

Nate
  • 333
  • 3
  • 15

2 Answers2

0

Looks like Yuki Doi had you to it with "Blade Runner". This extension does exactly what you're looking for, it automatically runs build task when a folder is opened.

Related question

benshabatnoam
  • 7,161
  • 1
  • 31
  • 52
0

Have a look at run task on folderOpen option: vscode docs.

This works for me:

// in tasks.json

{
  "label": "Tasks: copy3",
  "type": "shell",
  "command": "gulp",
  "args": [
    "copy3",
    "--file",
    "${fileBasename}"
  ],
  "problemMatcher": [],
  "runOptions": {
    "runOn": "folderOpen"
  }
},

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.

Mark
  • 143,421
  • 24
  • 428
  • 436