legendary-doc-site/apps/admin/lib/mix/tasks/customize_kaffy_templates.ex
2020-07-24 17:10:50 -05:00

22 lines
542 B
Elixir

defmodule Mix.Tasks.Legendary.CustomizeKaffyTemplates do
use Mix.Task
@shortdoc "Overwrites kaffy templates with custom versions."
def run(_) do
base = Path.expand("lib/kaffy_web/templates/")
replacements =
base
|> Path.join("**/*.eex")
|> Path.wildcard()
new_base =
Mix.Project.deps_path()
|> Path.join("kaffy/lib/kaffy_web/templates")
replacements
|> Enum.each(fn template_path ->
File.copy(template_path, template_path |> String.replace(base, new_base))
end)
end
end