defmodule CvGen do @moduledoc """ Documentation for `CvGen`. """ @template_file "lib/templates/cv.html.eex" @data_file "lib/templates/cv.json" @output_file "lib/templates/output.html" def generate do with raw_data <- File.read!(@data_file), {:ok, assigns} <- Jason.decode(raw_data, keys: :atoms), res <- CvGenView.cv(assigns) |> Phoenix.HTML.Safe.to_iodata() |> List.to_string(), do: File.write!(@output_file, res) end end