VSCode Live Server 插件安装和使用

VSCode Live Server是一个由Ritwick Dey开发的Visual Studio Code扩展插件,它提供了一个带有实时重载功能的本地开发服务器。在VSCode中安装和使用Live Server插件进行实时预览和调试Web应用程序。这将大大提高前端开发效率,使网页设计和开发变得更为流畅。

1、安装 Live Server 插件

2、打开HTML项目

在VSCode中打开包含HTML文件的工作区。

3、启动Live Server

有2种方式可以启动Live Server:

  • 点击右下角状态栏中的"Go Live"图标。
  • 右键点击HTML文件,在弹出菜单中选择"Open with Live Server"。

4、修改端口

打开 live server 设置

找到settings: port,点击 "Edit in settings.json" 修改

修改端口配置,这里端口修改成8080

bash 复制代码
"liveServer.settings.port": 8080

5、访问页面

Live Server启动后,在浏览器中输入http://localhost:8080来访问页面。

在编辑HTML、CSS或JavaScript文件时,保存文件后,页面会自动刷新以展示最新的内容。

6、注意事项

端口冲突

确保没有其他应用占用了Live Server的端口,否则可能需要更改端口号。

相关推荐
Tisfy20 小时前
Windows - VsCode导致Windows凭据过多之一键删除
ide·windows·vscode
姜太小白2 天前
【VSCode/Trae】trae已安装的扩展如何导出
ide·vscode·编辑器
danyang_Q2 天前
vscode python-u问题
开发语言·vscode·python
ChenYY~2 天前
手把手教你使用vscode开发stm32!
vscode·stm32·嵌入式·软件开发·学习经验
CodeQingqing3 天前
cubemx + Keil + vscode + Keil Assistant 工作流
ide·vscode·编辑器·keil
Chasing Aurora3 天前
vscode连接 服务器进行 深度学习
linux·ide·vscode·深度学习·研究生·解压缩·连接服务器
西柚云3 天前
把Codex装进VSCode!OpenAI编程助手插件版来了
服务器·ide·vscode·ai编程·codex
推理幻觉3 天前
vs code ssh使用codex
vscode·ssh·codex
十铭忘4 天前
windows下右键没有通过Vscode打开
ide·windows·vscode
红叶尽染寂绀蓝4 天前
已解决:同一ip下,Mac和Windows同时用vscode连接某个Linux远程服务器后,Mac再次连接时无法正确打开远程文件夹,由于转发设置导致
linux·服务器·windows·vscode·tcp/ip·macos