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?
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?
Recently came across this feature in one of the visual studio code tutorial in www.lynda.com
Press Ctrl + K followed by M, it will open the "Select Language Mode" ( or click on the right hand bottom corner that says HTML before that smiley ), type markdown and press enter
Now Press Ctrl + K followed by V, it will open your html in a near by tab.
Tadaaa !!!
Now emmet commands were not working in this mode in my html file, so I went back to the original state ( note - html tag tellisense were working perfectly )
To go to original state - Press Ctrl + K followed by M, select auto-detect. emmet commands started to work. If you are happy with html only viewer, then there is no need for you to come back to the original state.
Wonder why vscode is not having html viewer option by default, when it is able to dispaly the html file in the markdown mode.
Anyway it is cool. Happy vscoding :)
Ctrl + F1 will open the default browser. alternatively you can hit Ctrl + shift + P to open command window and select "View in Browser". The html code must be saved in a file (unsaved code on the editor - without extension, doesn't work)
VS Code has a Live Server Extention that support one click launch from status bar.
Some of the features:
You can now install an extension View In Browser. I tested it on windows with chrome and it is working.
vscode version: 1.10.2
Here is the version 2.0.0 for Mac OSx:
For Mac - Opens in Chrome - Tested on VS Code v 1.9.0
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.
Once in the tasks.json file. Delete the script displayed and replace it by the following: