From bfaf82f2640ada81ded11b8b0a081d48eb07a298 Mon Sep 17 00:00:00 2001 From: Romulus21 Date: Wed, 20 Sep 2023 08:49:30 +0200 Subject: [PATCH] add clear build command --- app/Console/Commands/ClearBuild.php | 51 +++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 app/Console/Commands/ClearBuild.php diff --git a/app/Console/Commands/ClearBuild.php b/app/Console/Commands/ClearBuild.php new file mode 100644 index 0000000..3f0fed0 --- /dev/null +++ b/app/Console/Commands/ClearBuild.php @@ -0,0 +1,51 @@ +file); + } + + $count = 0; + foreach (File::files(public_path('build/assets')) as $file) { + if (! in_array($file->getFilename(), $filesUsed)) { + unlink($file->getPathname()); + $count++; + } + } + + $this->info($count.' files deleted.'); + } catch (Exception $e) { + $this->error($e->getMessage()); + } + } +}