Better local GitHub Pages with Pow
A couple years ago I covered how I setup a local GitHub Pages build environment using Pow with Rack. Things broke on me recently, and while trying to fix them, I found an even easier way.
In my original post, I outlined usage of Rack to configure Pow to serve the static files generated by Jekyll. It turns out this isn’t really needed — Pow ships with support for serving static files, eliminating most of what the Rack approach offers.
Most? What’s missing? So far, the only thing I’ve noticed that doesn’t work
is 404 pages. I don’t really need these in development, just being able to
open 404.html
in a browser to work on the page itself is enough.
What does my setup look like now?
The project’s Gemfile
:
source "https://rubygems.org"
gem "github-pages"
Pow setup — the key here is manually creating the directory under ~/.pow
the symlinking a public
directory to the _site
directory that Jekyll
creates:
mkdir -p ~/.pow/myblog ~/work/myblog/_site
ln -s ~/work/myblog/_site ~/.pow/myblog/public
Build the blog:
jekyll build
And open in your browser:
open http://myblog.dev/