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

前端 未结 23 1701
[愿得一人]
[愿得一人] 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 17:49

    If you're just on Mac this tasks.json file:

    {
        "version": "0.1.0",
        "command": "open",
        "args": ["${file}"],
    }
    

    ...is all you need to open the current file in Safari, assuming its extension is ".html".

    Create tasks.json as described above and invoke it with +shift+b.

    If you want it to open in Chrome then:

    {
        "version": "0.1.0",
        "command": "open",
        "args": ["-a", "Chrome.app", "${file}"],
    }
    

    This will do what you want, as in opening in a new tab if the app is already open.

提交回复
热议问题