Swift製の静的サイトジェネレーター「Spelt」を使ってみる
Swiftで書かれたStatic Site Generatorを見つけたので試してみました。
njdehoog/Spelt: Delightfully simple static site generator written in Swift
Macアプリ用に作られたようですが、CLIはオープンソースで公開されています。
Spelt導入・プロジェクト作成
$ git clone --recursive https://github.com/njdehoog/Spelt.git
$ make bootstrap
$ make prefix_install
$ spelt new hello-spelt
$ cd hello-spelt/
設定・プレビュー
# _config.yml
title: "Hello Spelt"
description: >
Spelt Example
url: "http://hello-spelt.bornneet.com"
date_format: "MMM dd, yyyy"
paginate: 5
$ spelt preview
# http://0.0.0.0:ポート番号
GitHub Pagesで公開
# build.sh
#!/bin/sh
rm -rf docs
spelt build --destination docs
echo "hello-spelt.bornneet.com" > docs/CNAME
$ ./build.sh
# .gitignore
_build
$ git init
$ git add .
$ git commit -m "first commit"
$ git remote add origin git@github.com:tnantoka/hello-spelt.git
$ git push origin master
こんな感じで公開できました。
http://hello-spelt.bornneet.com/
しばらく使ってみようと思います。