无法加载资源404 style.css firebase

时间:2018-01-16 23:38:33

标签: firebase firebase-hosting

从我的静态网站

接收以下控制台日志
Failed to load resource: the server responded with a status of 404 ()

on style.css

项目结构

root - home.html root中的文件夹 - styles 文件内部'样式'文件夹 - style.css

(它是一个简单的网站,用于测试firebase)

我已经使用firebase创建了我的网站实例,并将我的html输出到index.html但没有css文件的公共文件夹。

public/index.html

一样

我已使用<style media="screen">添加了内联css来解释这个问题并且它有效,但它仍然无法读取/找到我的style.css文件

{p} style.css内的index.html链接(创建了firebase)

<link rel="stylesheet" type="text/css" href="../style/style.css">

查看其他答案,但他们正在使用bootstrap提供的cdn / url。我希望能够使用我创建的那个。

1 个答案:

答案 0 :(得分:3)

Firebase托管仅托管public folder下的文件。这意味着您的style文件夹未上传,因此index.html无法检测到css文件。

您需要移动样式文件夹以将其放在公共文件夹中,并将链接更改为:

<link rel="stylesheet" type="text/css" href="style/style.css">
相关问题