~mika/www.m1kadev.nl

ref: bce19303cd873fea1ee082f7c87b407300d38e23 www.m1kadev.nl/kethel/lib/bricks.ex -rw-r--r-- 465 bytes
bce19303 — m1kadev kethel: add support for pages/ 6 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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()

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