我试图在Firebase上托管已存在的项目,该项目已经有一个css和js文件。但它似乎没有将我的css和js文件包含在网站中 我遵循了所有这些步骤: https://www.youtube.com/watch?v=meofoNuK3vo&index=21&list=PLl-K7zZEsYLmnJ_FpMOZgyg6XcIGBu2OX
项目目录现在如下所示:
\ public(文件夹)(包含:index.html 404.html)
\ css(文件夹)(包含:style.css)
\ _ js(文件夹)(包含:index.js)
firebase.json
.firebaserc
以下是网站:https://together-cb.firebaseapp.com/
索引文件如下所示:
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../css/style.css">
<!-- update the version number as needed -->
<script defer src="/__/firebase/4.8.0/firebase-app.js"></script>
<!-- include only the Firebase features as you need -->
<script defer src="/__/firebase/4.8.0/firebase-auth.js"></script>
<script defer src="/__/firebase/4.8.0/firebase-database.js"></script>
<script defer src="/__/firebase/4.8.0/firebase-messaging.js"></script>
<script defer src="/__/firebase/4.8.0/firebase-storage.js"></script>
<!-- initialize the SDK after all desired features are loaded -->
<script defer src="/__/firebase/init.js"></script>
<script src="/__/firebase/4.8.0/firebase.js"></script>
<script src="../js/index.js"></script>
</head>
<body>
<div class="main-view">
....
</div>
</body>
</html>
答案 0 :(得分:0)
我遇到了同样的问题,但我在我的身体标签下面添加了这一行,并解决了。
<script src="/__/firebase/6.1.1/firebase-firestore.js"></script>
另外,您可以在此处查看说明 https://firebase.google.com/docs/web/setup
答案 1 :(得分:0)
确保所有资产(css,js,img)和html都位于/ public