I want to start using github pages for documentation, which would allow me to host them on github but still edit them locally and just push the edits. The problem is debugging. Anything that relies on AJAX is a security risk if I'm trying to get local files, so browsers reject any $.get('localfile.json'). I understand the restriction, but it makes development very annoying. There are proposals to allow some kind of package, with only descendents of the current file, but everyone is too scared that users will download something to their Documents folder and expose themselves.

So the only solution seems to be to set up a local http server and use that. The simplest I've found (not very fast, but I don't need that) is to use python's http.server. First, install python (choco install python works), and then in my PowerShell profile I have a line:

function svr { Start-Process "C:\tools\python\python.exe" "-m http.server" }

So I navigate to my desired folder, run svr, and it starts a python window running the server. localhost:8000 is the URL of the folder the server is running on.

Leave a Reply


Warning: Undefined variable $user_ID in /home/public/blog/wp-content/themes/evanescence/comments.php on line 75