Skip to content

Instantly share code, notes, and snippets.

@sgrove
Created March 28, 2015 18:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sgrove/237188f18c4b3f76fd34 to your computer and use it in GitHub Desktop.
Save sgrove/237188f18c4b3f76fd34 to your computer and use it in GitHub Desktop.

OCamlion

OCamlion (pronounced oh-camelion) is a static-site generator, useful for blogs and documentation. It relies on git as the underlying state/history mechanism for all source material.

Workflow

OCamlion can be used from either the command line, as a scriptable tool, or inside the browser itself.

Browser workflow

At a high-level, we use Irmin to pull a blog's git repository into the browser and store the raw git history in IndexedDB. We then render both your site and some administration tools in a special editing mode. You can edit and see changes in real-time, save changes locally, and push them to the remote repository when you're finished.

Command-line workflow

Install the ocamlion OPAM package and use the cli to generate your site and open it in a browser locally:

opam install ocamlion ocamlion new my_site && cd my_site ocamlion gen -s content -d _site ocamlion open

Deployment

Kick off a rebuild of your site. All the convenience of a distributed blogging site, with none of the overhead.

Libraries

  • js_of_ocaml (compiles all of the pure-ocaml implementations in javascript, provides access to browser events, etc.)
  • omd (Markdown parsing/HTML-string generation)
  • omdPlumbing (adds in the {{variable}} syntax, converts to <t:insert name="variable-name"> html string)
  • xmlm (Parses/streams xml to treat it as reified data structure, rather than simple string manipulation)
  • lwt (concurrency, but not actually used yet)
  • Irmin (state, history, and git support)

Copyright

Copyright (c) 2015 {{author.name}} <{{author.email}}>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment