The problem with my usual blogging attempts is that I tried only to document successes. Let's be honest: there's no real success in writing, nor have I ever experienced any real success in programming. Thus, I'd only blog whenever I'd fool myself into being successful for a moment.
This blog will hopefully be dedicated mostly to my failures. I fail a lot, so here's that. I've found that documenting as much as possible is nice for me sometimes – helps me with coming back to things. Those things will hopefully include Haskell, gamedev, videogame criticism and philosophy.
This site is built using Slick, a Haskell static site builder. It seems nice. The build time is quite slow – probably because it uses more than a hungred packages. I used heroku to host this.
A little tutorial for the laziest, like me:
We're only interested in the example-site from the git repo:
git clone https://github.com/ChrisPenner/Slick cp -R Slick/example-site/* . rm -rf Slick
stack.yaml, you want those two options:
packages: - . # - .. # comment this out extra-deps: - slick-0.1.1.0 # add this one
stack buildfor the first time, to get the packages. It will take 15 minutes or so: a lot of packages.
There're two different things to build: the haskell program, and then the website itself using this program. The program will take a couple minutes to build every time. You can build it with
stack build. Or better, to rebuild the executable on every change to the
*.hsfiles, in an extra terminal run and keep running:
stack build --file-watch --fast
Now that you have the executable, run it to build the website:
stack exec example-site-exe site -- --rebuild
The website will be in the
dist/folder. (Change the
package.yamlto rename the executable if you ever get around to it).
OK, here's your website. Now, two heroku tricks for easy serving.
Create a file called
<?php header('Location: /index.html'); ?>
Yep, this is the simplest way to serve a static site on heroku: by pretending it's PHP.
To push only the
dist/folder, you can do:
git subtree push --prefix dist heroku master. A fancier push (e.g. for
--force) can be done like this:
git push heroku `git subtree split --prefix dist master`:master --force
stack exec example-site-exe site && git add dist && gca -m "site update" && git subtree push --prefix dist heroku master
does the whole trick, provided you've built the up-to-date executable as in pt. 5.