Search code examples
firebasefirebase-hosting

Failed to load resource 404 style.css firebase


Receiving the following console log from my static website

Failed to load resource: the server responded with a status of 404 ()

on style.css

Project structure

root - home.html folder inside root - styles file inside 'styles' folder - style.css

(It's a simple website, for testing firebase)

I've used firebase to create the instance of my website and it outputted my html to a public folder with index.html but no css files.

Like so public/index.html

I've added inline css to account for this by using <style media="screen"> and it works but it's still not reading/finding my style.css file

style.css link inside index.html (firebase created)

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

Looked into other answers but they're using bootstrap supplied cdn/url. I want to be able to use the one I created.


Solution

  • Firebase hosting will only host the files under your public folder. Which means that your style folder is not being uploaded and thus index.html can't detect the css file.

    You need to move your style folder to have it inside the public folder and change the link to:

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