用VS Code編寫html文件,想在VS Code中直接打開運行炼七,配置如下:
配置tasks.json
- 打開VS Code缆巧,點擊“終端”特石,選擇“配置任務”盅蝗。
選擇“使用模板創(chuàng)建tasks.json文件”。
選擇“Others”姆蘸。
- tasks.json新建完成,默認如下圖:
- 修改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,process]
"command": "Chrome",
"args": ["${file}"],
"windows": {
"command": "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe"
},
"group": "build",
"presentation": {
// Reveal the output only if unrecognized errors occur.
"reveal": "never" //[always,never,silent]
},
// Use the standard MS compiler pattern to detect errors, warnings and infos
"problemMatcher": "$msCompile"
}
]
}
運行任務
選中需要運行的html文件逞敷,按住Ctrl+Shift+B,選擇“在Chome中運行”推捐,即可裂问。