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 trial

JavaScript jQuery Basics (2014) Creating a Simple Drawing Application Preparation

Why can't I get my CSS and App.js to also run the program like they do in Workspaces?

I just started using Notepad ++ to do this project and I was wondering why the code is the only think I see when I run the CSS or App.js file. I noticed that it runs the program as it should no matter what is open in Workspaces. The only thing that runs the program the way it is supposed to in Notepad++ is the index.html. I know that HTML is the main part of the program, so it runs the program like it should. However, I want to be able to have all of them run no matter what is open and to be able to check for errors with the developer tools if the program doesn't work the way it should. How do I do this?

3 Answers

Cindy Lea
PLUS
Cindy Lea
Courses Plus Student 6,497 Points

When you use CSS you need to also have a server. HTML alone will work on the desktop, but CSS needs a server. There are websites that give you free webpages with a domain. Treehouse has a video on how to setup a webpage including several links to some great sites. I cant recall the sites from the top of my head.

Carlos Sanchez
Carlos Sanchez
8,900 Points

The problem is that if you are copying the text from the workspace and creating the .css, .js and html files, then you may be changing the structure of the source of the files, what i mean by this is that in the index.html file you need to specify and list where is the app.js and css file to the page, so the browser can find them. Hope that solves your problem.

It should work, since the paths "css/style.css" and "js/app.js" are pointing to the right place either in Workspaces or on your local machine. Just open "index.html" with Chrome and it should work. Copying and pasting should make no difference (I used to do that before I knew you could just download the whole thing).

You don't need to run a web server to load a website on your local computer. Don't worry about that until you get into Node (or whatever server-side language you're studying). Even then it's as simple as running "node server.js" from terminal. But I digress.

My only guess is that you are downloading a zip and not extracting the zip to a folder. I realize the comment is 8 months old, but that is a common mistake. I believe Macs extract zips automatically, whereas on Windows when you double click a zip it shows you the contents of the zip.