News for hackers. Stuff that matters.
Re:Make This in an Hour by loocsinus on Sunday March 29, 2015 @02:56PM (#9285988)
Student here. Why do you run a localhost web server before pushing to git? Is this a git thing? (I am a newbie to github). Thanks. I like this nice short article.
Re:Make This in an Hour by adregan on Sunday March 29, 2015 @03:43PM (#9286197)
It's not necessary for git, no. However, it's a really good habit to get in—you make some changes to the project and then test it locally before pushing your changes to your git repo (on github and/or elsewhere). This way, you make sure your changes didn't break something that was previously working.

Now as to why start the simple http server to check your work vs. opening the index.html file directly in the browser:

1) relative links can behave in an unexpected manner using the file:// path, and you'll get more consistent behavior using the server

2) There are sometimes permissions errors loading scripts into the page when it's displaying through file:// (relatedly, protocol relative links eg. //code.jquery.com/jquery-2.1.3.min.js won't work).

Re:Make This in an Hour by juliangregorian on Sunday March 29, 2015 @05:20PM (#9286532)
3) AJAX won't work (since there's no HTTP backend to talk to)
Re:Make This in an Hour by skeoh on Sunday March 29, 2015 @07:42PM (#9286943)
Not _entirely_ true. AJAX will work, it just cannot access the 'file:' protocol by default. Requesting HTTP content will work fine.
Re:Make This in an Hour by juliangregorian on Friday April 10, 2015 @01:40AM (#9352741)
Haha, okay sure you are technically correct (although that's what I was getting at), but I'm going to nitpick you back and remind you that "requesting HTTP content" will not in general work because of same origin policy.
Re:Make This in an Hour by adregan on Sunday March 29, 2015 @07:06PM (#9286841)
I knew I was forgetting something.