Skip to content

Commit

Permalink
Add script to view the github pages locally
Browse files Browse the repository at this point in the history
We need a development webserver to view the calculator locally,
because it does AJAX requests and those don't work over the file:// protocol.

This repo is just a collection of static files,
so there was no platform yet that could act as a webserver.
I've decided to go for ruby because that is what github pages uses
if you want more than just static files.
https://help.github.com/articles/using-jekyll-as-a-static-site-generator-with-github-pages/
  • Loading branch information
odegroot committed May 28, 2017
1 parent efda94a commit 11c634d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions serve-github-pages.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env ruby

# Preview the rendered GitHub Pages in a browser.
# Inspired by http://asciidoctor.org/docs/user-manual/#external-preview

# Utilities to replace common UNIX commands in Makefiles etc
# https://github.com/ruby/ruby/blob/trunk/lib/un.rb
require 'un'

# Pass these values as command line arguments to httpd.
ARGV.replace [File.expand_path('.', __dir__), '--port=8080']

# Start the http server.
httpd

0 comments on commit 11c634d

Please sign in to comment.