1

How can I change the configurations to load a custom file using lite-server "browserSync" like "about.html" instead of the default one "index.html"?

4

2 回答 2

3

您需要使用该startPath 选项并指示您的about.html文件。最简单的方法是bs-config.json在项目的根目录中创建一个文件。这将在运行时自动读取并覆盖 Lite-Server 的默认值。这是您在文件中唯一需要的东西bs-config.json

{ "startPath": "about.html" }

我已经使用了这个非常配置并且它成功运行。请记住,如果about.html与配置文件不在同一目录中,请确保正确指定其路径。

于 2018-09-19T03:46:56.207 回答
0

无需更改配置即可加载您的自定义文件,只需在 URL 后添加 /about.html,因为默认情况下,只有 URL 会加载您的 index.html 文件。

于 2020-04-29T05:36:17.750 回答