Skip to content

Instantly share code, notes, and snippets.

@davedevelopment
Forked from igorw/build.sh
Created December 14, 2012 22:25
Show Gist options
  • Save davedevelopment/4289204 to your computer and use it in GitHub Desktop.
Save davedevelopment/4289204 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Amazing static site generator
# Works for PHP and HTML sites
# Assumes web root to be in /web
# Dumps the site into a directory named "static"
#
# rm -rf static/*; seq 1 4 | time parallel -j 4 ./build.sh 900{}
PORT=${1:-9999}
php -S localhost:$PORT -t html >/dev/null &
PID=$!
sleep 0.3
wget -r -l inf --no-remove-listing --adjust-extension -nH --no-use-server-timestamps -nc -q -P static http://localhost:$PORT
kill $PID
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment