Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJoseph Lander
Full Stack JavaScript Techdegree Graduate 27,765 PointsConnect the CSS file - not currently referenced
I wanted to add the 3 items we add on the home page as list items using <li>
tags. I didn't want the bullet styling so added a declaration in the CSS to remove that but it didn't apply. It appears that there are stylesheets in the public
folder that aren't connected to the index.html
file.
I added a link in the head of layout.pug
link(rel="stylesheet", href="stylesheets/style.css")
this doesn't work for me.
In the console it returns GET /stylesheets/style.css 404
as it is not finding it.
I can't see how to connect it as none of the following file paths are working for me:
../stylesheets/style.css
, ./stylesheets/style.css
, stylesheets/style.css
or ./public/stylesheets/style.css
.
I have a vague knowledge that it should not need to be prefixed with public/
as the pathname was set up in app.js
. However, does this only become active when the code is deployed rather than as we are in the development server?
1 Answer
Joseph Lander
Full Stack JavaScript Techdegree Graduate 27,765 PointsIf you go on to the next Express practice challenge, the first task is to link static files to your project! You need to use middleware to link static files in Express - That was the issue.
Don't forget to reset your npm script so that the changes take effect. It will be referenced but here is a link if you want to add it to this project: https://expressjs.com/en/starter/static-files.html#serving-static-files-in-express