我正在使用lite-server开发一个Angular应用程序。我的项目结构如下,非常简单:
build/
foo/
index.html (references foo.js script)
bar/
index.html (references bar.js script)
foo.js
bar.js
bsconfig.json我想要做的是访问localhost:8000/foo并让foo/index.html加载foo.js脚本,以及访问localhost:8000/bar和获取bar/index.html加载bar.js。
我已经阅读了Browsersync options文档,并尝试使用routes配置bs-config.json文件,但我无法使其正常工作。
发布于 2016-09-07 19:02:07
您可以向服务器对象添加路由
routes : {"/foo" : "build/foo", "/bar" : "build/bar" }您可以将您的foo.js和bar.js分别放在"foo“和”bar.js“文件夹下并在本地引用它们,或者将其保留在项目文件夹中并将其引用为"/foo.js”和"/bar.js“
发布于 2016-08-03 10:45:25
您可以将base href设置为指向index.html文件中的不同文件夹。
<base href="/foo/">
<base href="/bar/">此外,您还必须在system.config文件中配置提供主包的位置。
https://stackoverflow.com/questions/38733493
复制相似问题