Mahmud Adam
Mahmud Adam

Reputation: 3579

Run in browser with VS Code

How do I run my HTML in a browser using VS Code? I've tried to find instructions online but I cannot find a solution.

I tried adding this to my tasks.json:

{
"version": "0.1.0",

"command": "explorer",

"windows": {
    "command": "explorer.exe"
},

"args": ["index.html"]
}

But if I ctrl + shift + b it just opens my documents folder instead of the browser. I tried the steps here: How to view my HTML code in browser with Visual Studio Code? but nothing has worked so far.

Upvotes: 0

Views: 2650

Answers (1)

GJSmith3rd
GJSmith3rd

Reputation: 816

Currently, I use Gulp, NodeMon and BrowserSync with VSC Tasks and Debugger and this works really well on multiple PC's and devices. This can take a bit of setup though. Link to Stack Post

At the time of this writing, recently an extension called Debugger for Chrome was developed by MS. I find this debugger very useful and flexible. One of it's features allows starting a debugging instance in Chrome for the client side app. Without break points it will just load the client side app in the chrome browser. I frequently switch between this client debugger and the native Chrome Dev tools.

Debugger for Chrome

There also an extension I haven't tried called View In Browser.

View In Browser

Upvotes: 1

Related Questions