CSS stylesheets won't load as resource
Closed this issue · 4 comments
repo link = https://github.com/cwcox/taylor
Style sheet are linked in index.html but do not effect the browser view and do not get loaded as resources (based on the dev tools).
I believe it may have something to do with the routes defined in index.js.
However, I have also tried inline styling and that does show up either.
Got a couple things going on here:
-
In
index.js
the lineapp.use('/assets', express.static('public'))
means any requests coming into/assets/*
should look for static assets (files with extensionshtml
,js
,css
, etc) in thepublic/
directory. This means a request tolocalhost:3000/assets/css/index.css
will look for a file inpublic/css/index.css
. The file is actually atpublic/assets/css/index.css
so the request needs to be made tolocalhost:3000/assets/assets/css/index.css
or the path/assets/assets/css/index.css
. This is a little weird so you might just want to get rid of theassets
directory in public. -
These lines:
<link rel="stylesheet" src="css/index.css">
<link rel="stylesheet" ng-href="./css/taylor_index.css">
need to be:
<link rel="stylesheet" href="/assets/assets/css/index.css">
<link rel="stylesheet" href="/assets/assets/css/taylor_index.css">
Just switched it up to match the above and everything works great. Thanks!
Now the stylesheets load, but none of my components do! They load to the browser but aren't put into the view. I have update the repo
never mind, it was hidden under the header.