1
1
mirror of https://github.com/srid/rib.git synced 2024-11-30 03:45:00 +03:00
Haskell static site generator based on Shake (superseded by Ema)
Go to file
Sridhar Ratnakumar bc380f5869 Add ghcid script
2019-07-13 15:11:04 -04:00
example Rib.Pandoc: add pandocH1 2019-07-13 14:39:36 -04:00
src/Rib Add ghcid script 2019-07-13 15:11:04 -04:00
.gitignore Flesh out example in README 2019-07-02 09:27:37 -04:00
default.nix Drop reflex-platform 2019-07-11 13:58:46 -04:00
ghcid Add ghcid script 2019-07-13 15:11:04 -04:00
README.md Add ghcid script 2019-07-13 15:11:04 -04:00
rib.cabal Use Read instead of FromJSON in Yaml metadata 2019-07-12 16:32:47 -04:00

rib

Rib is a static site generator written in Haskell using sensible technologies like Shake, Lucid and Clay. It is nearly done but still a work in progress and will soon be ready for general use.

Example

See ./example (author's actual website in fact) to see how the Rib library can be used to write your own static site generator in a few lines of code which includes the HTML and CSS of the site:

$ cloc --by-file example/Main.hs
[...]
-------------------------------------------------------------------------------
File                             blank        comment           code
-------------------------------------------------------------------------------
example/Main.hs                     15              6             90
-------------------------------------------------------------------------------

With Rib you do not have to deal with the less powerful template engines or write raw HTML/CSS by hand. Do everything in Haskell, and concisely at that!

To get the example site up and running run:

cd ./example
../ghcid

This will:

  • Drop into a nix-shell with needed Haskell dependencies
  • Compile the rib library and example/Main.hs through ghcid
    • Whenever Haskell sources change ghcid reloads them
  • Run example/Main.hs:main with serve -w CLI arguments
  • This does the following:
    1. Generate ./content into ./content.generated using Shake
    2. Listens for changes to ./content, and re-generate them (the -w argument)
    3. Start a HTTP server serving the ./content.generated directory (the serve part)

Thus, by running that one command you get a production-quality web server serving your statically generated HTML files that automatically get regenerated when the source content changes. What's more, you may change the Haskell sources such as Main.hs and ghcid will recompile and relaunch the whole thing. With rib you get hot reload for free.