如何像在浏览器中一样在 vscode 中打开 HTML 文件? [英] How to open HTML file in vscode like in browser?
问题描述
vscode 或任何扩展更新完成后,vscode 中将显示发行说明.我在电脑里能找到releasenote,是HTML文件,我用vscode打开,vscode显示的是HTML代码,不喜欢用浏览器打开.
After the vscode or any extension update finished, a release note will show in vscode. I can find the releasenote in my computer, it is HTML file, I open it by vscode and vscode shows the HTML code, don't like open by browser.
一般来说,我想在浏览器以外的vscode中查看html.我在网上搜过,都是用vscode打开浏览器查看html文件.
General speaking, I want to view html in vscode other than browser. I had searched it in internet, all are open browser by vscode and view html file.
我知道 vscode 可以做到,但我不知道该怎么做,啊哈.
I know the vscode can do it but I don't know how to do, aha.
谢谢.
推荐答案
VS Code 不包括对 html 页面预览的内置支持.这可以通过扩展程序提供.
VS Code does not include built-in support for previewing html pages. This can be provided by an extension.
如果您有兴趣自己实现,请查看 webview api
If you are interested in implementing this yourself, take a look at the webview api
但是,正如@herrbischoff 所指出的,您应该考虑改变您的工作流程或期望.合适的浏览器将提供更好的开发体验和扩展,例如 browser sync 可以将 VS Code 连接到您选择的浏览器
However, as @herrbischoff noted, you should consider changing your workflow or expectations. A proper browser will offer a much better development experience and extensions like browser sync can connect VS Code to your browser of choice
这篇关于如何像在浏览器中一样在 vscode 中打开 HTML 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!