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 trialCarlos Lantigua
5,938 PointsAdding css to a separate file
Trying to put css in a separate file for the node.js treehouse API project and I am not able to using conventional methods. If I make a seperate file named "css.styles" would I have to write it in the node file as
renderer.view("styles", {}, response);
or would I have to use something else?
1 Answer
Erika Suzuki
20,299 PointsIf the website is deployed live, you have to either serve the static assets (css, js, images, fonts) from a web server (nginx, apache, etc.) or use a readily available Javascript module to serve assets programmatically.
Or if you're up for some challenge, you can make it yourself by making a router for static assets, dynamically determine content-type and then pass it to the response.
Erika Suzuki
20,299 PointsErika Suzuki
20,299 PointsAnyway, let's stay tuned, may be it'll be taught to us here in this course. :)
Carlos Lantigua
5,938 PointsCarlos Lantigua
5,938 PointsThank you for the reply, I'm sorry I haven't been on treehouse in a while because I'm working on coding projects.
Erika Suzuki
20,299 PointsErika Suzuki
20,299 PointsCarlos Lantigua sure! Anyway, having done the rest of the course. There is a way using Express JS! It's incredibly easy.
Saud Tauqeer
Courses Plus Student 8,099 PointsSaud Tauqeer
Courses Plus Student 8,099 Pointscan we do all this stuff more easily on express?