美文网首页
VS Code运行HTML文件

VS Code运行HTML文件

作者: _孙小胖 | 来源:发表于2019-12-11 09:48 被阅读0次

配置tasks.json

1.打开VS Code,点击“终端”,选择“配置任务”。


image

2.选择“使用模板创建tasks.json文件”。


image
3.选择"Other"
image

4.tasks.json新建完成


image
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运行”


image

相关文章

网友评论

      本文标题:VS Code运行HTML文件

      本文链接:https://www.haomeiwen.com/subject/kjxogctx.html