Expug

Indented shorthand HTML templates for Elixir

Expug is a template language based on Pug (formerly known as Jade). This is a work-in-progress.

Status

Installation

Add expug to your list of dependencies in mix.exs:

def deps do
  #[{:expug, "~> 0.0.1"}]
  [{:expug, git: "https://github.com/rstacruz/expug.git"}]
end

Also see phoenix_expug for Phoenix integration.

The language

Expug lets you write HTML as indented shorthand, inspired by Haml, Slim, Pug/Jade, and so on.

doctype html
html
  meta(charset="utf-8")
  title Hello, world!
body
  a(href=@link)
    | This is a link

Also see:

Prior art

There's calliope and slime that brings Haml and Slim to Elixir, respectively. Expug offers a bit more:

How it works

Expug converts a .pug template into an EEx string:

iex> Expug.to_eex!(~s[div(role="alert")= @message])
"<div role=<%= raw(\"alert\") %>><%= @message %>"

See the module Expug for details.

To use Expug with Phoenix, see phoenix_expug.

Thanks

expug © 2016+, Rico Sta. Cruz. Released under the MIT License.<br> Authored and maintained by Rico Sta. Cruz with help from contributors (list).

ricostacruz.com &nbsp;&middot;&nbsp; GitHub @rstacruz &nbsp;&middot;&nbsp; Twitter @rstacruz