1
1
mirror of https://github.com/srid/rib.git synced 2024-11-29 19:09:55 +03:00
Haskell static site generator based on Shake (superseded by Ema)
Go to file
Sridhar Ratnakumar f36afc7019
Merge pull request #27 from srid/examples-as-project
Make examples independent cabal projects
2019-08-03 12:47:47 -04:00
examples Apply nix/cabal addition to other examples 2019-08-03 12:47:08 -04:00
src/Rib Make serve and watch the default command 2019-08-03 09:45:34 -04:00
.gitignore Vastly simplify configuration (#19) 2019-07-14 11:17:48 -04:00
default.nix Simplify examples default.nix 2019-08-03 12:40:45 -04:00
ghcid Make serve and watch the default command 2019-08-03 09:45:34 -04:00
README.md Apply nix/cabal addition to other examples 2019-08-03 12:47:08 -04:00
rib.cabal Cabal'ify examples/hello-world 2019-08-03 10:02:32 -04:00

rib

Rib is a static site generator written in Haskell that reuses existing tools (Shake, Lucid and Clay) and is thus non-monolithic. It is nearly done but still a work in progress and will soon be ready for general use.

Example

See ./examples/hello-world 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.

See ./examples/doc for a real-world example---Rib's own documentation site.

(Refer to Rib.Simple if you need further customization of the Shake action.)

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


To get an example site up and running run:

cd ./examples/hello-world
nix-shell --run 'ghcid -T main'

This will:

  • Drop into a nix-shell with needed Haskell dependencies (including rib)
  • Compile Main.hs through ghcid
    • Whenever Main.hs changes ghcid reloads them
  • Run Main.hs:main
  • This does the following:
    1. Convert sources in ./a into ./b using Shake
    2. Listens for changes to ./a, and re-generate them
    3. Start a HTTP server serving the ./b directory

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

With rib we get hot reload for free.