美文网首页学习
VS Code 运行html文件

VS Code 运行html文件

作者: AllanHao | 来源:发表于2018-09-25 16:44 被阅读2次

    用VS Code编写html文件,想在VS Code中直接打开运行,配置如下:

    配置tasks.json

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


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


      image
    3. 选择“Others”。


      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,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中运行”,即可。


    image

    相关文章

      网友评论

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

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