feat: Add clean mix task

This commit is contained in:
Robert Prehn 2025-01-10 16:09:02 -06:00
parent 1f9246e8db
commit 78f677b98b
No known key found for this signature in database
2 changed files with 21 additions and 0 deletions

View file

@ -0,0 +1,7 @@
defmodule Mix.Tasks.PreDotHn.Clean do
use Mix.Task
def run(_args) do
PreDotHn.clean()
end
end

View file

@ -36,6 +36,20 @@ defmodule PreDotHn do
def validate(other), do: {:ok, other}
def clean() do
"priv/static/**"
|> Path.wildcard()
|> Enum.each(fn path ->
if File.dir?(path) do
if !File.exists?(Path.join(path, ".keep")) do
File.exists?(path) && File.rm_rf!(path)
end
else
File.exists?(path) && File.rm!(path)
end
end)
end
def run() do
posts =
"site/**/*.md"