【发布时间】:2020-01-03 21:56:46
【问题描述】:
我使用 Firebase 上的不同网站具有以下结构(用于处理不同的主题)。
/src
/theme-1/index.html
/theme-2/index.html
所有的“果汁”都在src 中,index.html 文件对于theme-1 和theme-2 都是相同的,除了我引用.css 文件的那一行,我实际使用的地方不同的。
目前,我只配置了一个目标,但我会在firebase.json 中添加更多:
{ “托管”:{
"target": "theme-1",
"public": "theme-1",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{"source": "**","destination": "/theme-1/index.html"}
],
"cleanUrls": true,
"headers": [ {
"source": "**",
"headers": [ {
"key": "Cache-Control",
"value": "max-age=60"
} ]
} ]
}
}
然后我使用 cmd 命令配置我的目标以指向我的 firebase 站点:
firebase target:apply hosting theme-1 theme-1
然后部署网站:
firebase deploy
但是,当我访问该页面时(尽管它在本地工作),它似乎无法找到根文件夹 /src(404 错误)。
我怎样才能在我的部署中包含文件夹 /src 以便它以相同的方式工作?
【问题讨论】: