~mika/www.m1kadev.nl

ref: b6cc29114a448386356418cebbff35ca4793cd63 www.m1kadev.nl/kethel/lib/bricks.ex -rw-r--r-- 487 bytes
b6cc2911 — m1ka dockerise the building/running of www 3 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
defmodule Bricks do
  @typedoc "A path, relative to mix.exs"
  @type relative_path() :: binary()

  @typedoc "The name of the brick"
  @type brick_name() :: binary()

  @typedoc "A valid mustache template"
  @type mustache() :: binary()

  @type bricks() :: %{brick_name() => mustache()}

  @spec collect(relative_path()) :: bricks()
  def collect(folder) do
    Path.wildcard(folder <> "/bricks/*.thtml")
    |> Map.new(fn x -> {FileX.trimmed_filename(x), File.read!(x)} end)
  end
end