A static site generator for Elixir. Write pages as Markdown, style them with HEEx templates and Phoenix function components, and build a plain static site — with a dev server and live reload while you work.
Distilled ships an Igniter installer, so a new site is one command:
mix archive.install hex igniter_new # one-time, if you don't have it
mix igniter.new my_site --install distilledThis scaffolds a ready-to-build site: config/config.exs, a starter theme in
theme/ (HEEx layouts plus a MySite.Components module), and a first page in
content/.
Then:
cd my_site
mix distilled.server # dev server with live reload at http://localhost:4000
mix distilled.build # build the static site into out/mix igniter.install distilledOr add it manually to your mix.exs and run the installer:
def deps do
[
{:distilled, "~> 0.1.0"},
{:phoenix_live_view, "~> 1.2"}
]
endmix deps.get
mix distilled.installcontent/— Markdown files with optional YAML front matter. Directory structure is preserved in the output.theme/— the site's theme: HEEx layouts plus aPhoenix.Componentmodule. Front matterlayout:picks a layout per page;config :distilled, layout:sets the default. The rendered page HTML is available as@content, front matter as@page, and the site index as@site.theme/is on the compile path (elixirc_paths) so its components module compiles.- Components — define one or more modules (e.g.
MySite.Components,MySite.UI) intheme/usingPhoenix.Component, list them inconfig :distilled, components: [...], and call their functions (<.meta_tags />,<.callout>…</.callout>) from any layout. Every listed module's function is imported, so you can split components across files. out/— the built static site.
Until Distilled is published to Hex, you can still run the installer against a
local checkout by giving --install a @path: source pointing at this repo:
mix igniter.new my_site --install "distilled@path:/absolute/path/to/distilled"Two gotchas worth knowing:
-
Run it outside any Mix project.
mix igniter.newbootstrapsigniterby manipulating the current Mix project state, so running it from inside an existing project (e.g.distilled/ordistilled/example/) fails withcannot retrieve dependencies information because dependencies were not loaded. Run it from a plain directory with nomix.exsabove it. -
Skip
igniter.newentirely if you prefer. Scaffold a bare project and run the installer directly — this avoids the bootstrap step altogether:mix new my_site && cd my_site # add {:igniter, "~> 0.8"} to deps in mix.exs, then: mix deps.get mix igniter.install "distilled@path:/absolute/path/to/distilled"
The installer itself is covered by
test/mix/tasks/distilled.install_test.exs, which runs without any of the above
via Igniter's test helpers:
mix test test/mix/tasks/distilled.install_test.exsDocs can be generated with ExDoc and, once published, will be at https://hexdocs.pm/distilled.