diff --git a/packages/framework/src/Framework/Actions/PreBuildTasks/TransferMediaAssets.php b/packages/framework/src/Framework/Actions/PreBuildTasks/TransferMediaAssets.php index 657fa9ffac3..025c0ee7bcc 100644 --- a/packages/framework/src/Framework/Actions/PreBuildTasks/TransferMediaAssets.php +++ b/packages/framework/src/Framework/Actions/PreBuildTasks/TransferMediaAssets.php @@ -4,9 +4,25 @@ namespace Hyde\Framework\Actions\PreBuildTasks; +use Hyde\Hyde; +use Hyde\Support\Filesystem\MediaFile; use Hyde\Framework\Features\BuildTasks\PreBuildTask; +use Hyde\Framework\Concerns\InteractsWithDirectories; class TransferMediaAssets extends PreBuildTask { protected static string $message = 'Transferring Media Assets'; + + use InteractsWithDirectories; + + public function handle(): void + { + $this->needsDirectory(Hyde::siteMediaPath()); + + $this->withProgressBar(MediaFile::files(), function (string $identifier): void { + $sitePath = Hyde::siteMediaPath($identifier); + $this->needsParentDirectory($sitePath); + copy(Hyde::mediaPath($identifier), $sitePath); + }); + } } diff --git a/packages/framework/src/Framework/Services/BuildService.php b/packages/framework/src/Framework/Services/BuildService.php index 83c2686e011..203b17c1bc3 100644 --- a/packages/framework/src/Framework/Services/BuildService.php +++ b/packages/framework/src/Framework/Services/BuildService.php @@ -30,7 +30,6 @@ class BuildService { use InteractsWithIO; - use InteractsWithDirectories; protected RouteCollection $router; @@ -50,16 +49,7 @@ public function compileStaticPages(): void public function transferMediaAssets(): void { - $this->needsDirectory(Hyde::siteMediaPath()); - - $this->comment('Transferring Media Assets...'); - $this->withProgressBar(MediaFile::files(), function (string $identifier): void { - $sitePath = Hyde::siteMediaPath($identifier); - $this->needsParentDirectory($sitePath); - copy(Hyde::mediaPath($identifier), $sitePath); - }); - - $this->newLine(2); + // } /**