How to view an HTML file in the browser with Visual Studio Code

前端 未结 23 1667
[愿得一人]
[愿得一人] 2020-11-28 17:43

How can I view my HTML code in a browser with the new Microsoft Visual Studio Code?

With Notepad++ you have the option to Run in a browser. How can I do the same thi

23条回答
  •  抹茶落季
    2020-11-28 18:04

    For Mac - Opens in Chrome - Tested on VS Code v 1.9.0

    1. Use Command + shift + p to open the Command Palette.

    1. Type in Configure Task Runner, the first time you do this, VS Code will give you the scroll down menu, if it does select "Other." If you have done this before, VS Code will just send you directly to tasks.json.

    2. Once in the tasks.json file. Delete the script displayed and replace it by the following:

    {
        "version": "0.1.0",
        "command": "Chrome",
        "osx": {
            "command": "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
        },
        "args": ["${file}"]
    }
    
    1. Switch back to your html file and press Command + Shift + b to view your page in Chrome.

提交回复
热议问题