Current section
Files
Jump to
Current section
Files
lib/mix/tasks/phoenix_image.reset_cache.ex
defmodule Mix.Tasks.PhoenixImage.ResetCache do
@shortdoc "Deletes all cached resized images"
@moduledoc "Removes the phoenix_image cache directory so resized images are regenerated on next request."
use Mix.Task
@impl true
def run(_args) do
cache_dir = Path.join(File.cwd!(), PhoenixImage.cache_dir())
if File.dir?(cache_dir) do
File.rm_rf!(cache_dir)
Mix.shell().info("Cleared image cache: #{cache_dir}")
else
Mix.shell().info("No image cache to clear.")
end
end
end