Reputation: 60
How to 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 thing with Visual Studio Code?
I tried to manage the task.json file as:
{
"version": "2.0.0",
"tasks": [
{
"taskName": "Chrome",
"type": "process",
"command": "chrome.exe",
"windows": {
"command": "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"
},
"args": [
"${index.html}"
],
"problemMatcher": []
}
]
}
also i installed the View In Browser extenstion for VSCode, but also nothing happend.
Upvotes: 2
Views: 6371
Reputation: 180825
Change your "args" option to something like:
"args": [
"${workspaceRoot}/index.html"
],
You may need more directories to get to your index.html, I don't know your folder structure. But if index.html is in the root of your workspace the above will work.
Of course with this method you are not actually serving your web page or watching for changes to css, js or html so you would need to refresh your browser each time to see any changes.
Upvotes: 1