VS Code运行HTML文件
2019-12-11 本文已影响0人
_孙小胖
配置tasks.json
1.打开VS Code,点击“终端”,选择“配置任务”。
2.选择“使用模板创建tasks.json文件”。
3.选择"Other"
4.tasks.json新建完成
5.修改tasks.json
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "在Chrome中运行",
"type": "process",//shell
"command": "Chrome",
"args": ["${file}"],
"windows": {
"command": "C:/Program Files (x86)/Google/Chrome Dev/Application/chrome.exe" //谷歌安装位置
},
"group": "build",
"presentation":{
"echo": true,
"reveal": "never",
"focus": false,
"panel": "shared",
"showReuseMessage": true,
"clear": false
},
"problemMatcher":"$msCompile",
}
]
}
运行任务
1.选中要运行的HTML文件,按住ctrl+shift+B,选择“在chome运行”