Reputation: 25927
I'm often using VS Code for Html/Css/Js development. I'm often using the following task (from other SO post) to open HTML page in browser:
{
"version": "0.1.0",
"command": "explorer",
"windows": {
"command": "explorer.exe"
},
"args": ["${file}"]
}
Is there a way to add this task as default one for all folders?
Upvotes: 2
Views: 493
Reputation: 9222
The short answer is "no".
The slightly longer answer is, "no, but they are thinking about ways this can be done" as demonstrated in this issue.
A workaround is to add a snippet that you can easily add to tasks.json in new projects. Go to File > Preferences > User Snippets > json
and add something like this:
"Explorer Task": {
"prefix": "expTask",
"body": [
'{',
'\t"version": "0.1.0",',
'\t"command": "explorer",',
'\t"windows": {',
'\t\t"command": "explorer.exe"',
'\t},',
'\t"args": ["${file}"]',
'}'
],
"description": "Explorer task that I use so often"
},
Now when you go to tasks.json in any new project, you type expTask
(or whatever you name it) and you can easily drop this in.
Upvotes: 1