使用Visual Studio Code打开浏览器查看HTML文件

时间:2016-05-06 19:34:50   收藏:0   阅读:4103

vscode出来之前一直使用sublime,后者在编写HTML文件时可以通过点击鼠标右键,找到open in browser来启动系统默认浏览器,而vscode却没有这个功能,调试和预览起来比较麻烦。不过可以通过配置tasks.json文件来解决这个问题。

Ctrl+P打开命令面板,输入tasks.json然后回车打开这个文件,可以看到默认配置,然后修改如下:

{
    // See http://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "0.1.0",
    "command": "Chrome",    //使用chrome浏览器
    "windows": {
        "command": "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe" //chrome浏览器的路径
    },
    "isShellCommand": true,
    "args": ["${file}"],    //表示对当前文件进行操作
    "showOutput": "always"
}

保存后打开一个html文件,按组合键Ctrl+Shift+B就可以使用指定的浏览器打开html文件了。

 

原文:http://www.cnblogs.com/undefined000/p/5466626.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!