Skip to content

Commit e6f5ee2

Browse files
committed
Use the dynamic site output path helper
1 parent feabace commit e6f5ee2

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/Commands/HydeBuildStaticSiteCommand.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -119,21 +119,21 @@ protected function printFinishMessage(float $time_start): void
119119
$this->info('Congratulations! 🎉 Your static site has been built!');
120120
$this->line(
121121
'Your new homepage is stored here -> '.
122-
DiscoveryService::createClickableFilepath(Hyde::path('_site/index.html'))
122+
DiscoveryService::createClickableFilepath(Hyde::getSiteOutputPath('index.html'))
123123
);
124124
}
125125

126126
/**
127-
* Clear the entire _site directory before running the build.
127+
* Clear the entire output directory before running the build.
128128
*
129129
* @return void
130130
*/
131131
public function purge(): void
132132
{
133133
$this->warn('Removing all files from build directory.');
134134

135-
File::deleteDirectory(Hyde::path('_site'));
136-
mkdir(Hyde::path('_site'));
135+
File::deleteDirectory(Hyde::getSiteOutputPath());
136+
mkdir(Hyde::getSiteOutputPath());
137137

138138
$this->line('<fg=gray> > Directory purged');
139139

@@ -152,7 +152,7 @@ public function postBuildActions(): void
152152
{
153153
if ($this->option('pretty')) {
154154
$this->runNodeCommand(
155-
'npx prettier _site/ --write --bracket-same-line',
155+
'npx prettier '.basename(Hyde::getSiteOutputPath()).'/ --write --bracket-same-line',
156156
'Prettifying code!',
157157
'prettify code'
158158
);

src/Concerns/Internal/TransfersMediaAssetsForBuildCommands.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Hyde\Framework\Hyde;
66
use Hyde\Framework\Services\CollectionService;
7+
use Hyde\Framework\Concerns\InteractsWithDirectories;
78

89
/**
910
* Transfer all media assets to the build directory.
@@ -16,16 +17,19 @@
1617
trait TransfersMediaAssetsForBuildCommands
1718
{
1819
use BuildActionRunner;
20+
use InteractsWithDirectories;
1921

2022
/** @internal */
2123
protected function transferMediaAssets(): void
2224
{
25+
$this->needsDirectory(Hyde::getSiteOutputPath('media'));
26+
2327
$collection = CollectionService::getMediaAssetFiles();
2428
if ($this->canRunBuildAction($collection, 'Media Assets', 'Transferring')) {
2529
$this->withProgressBar(
2630
$collection,
2731
function ($filepath) {
28-
copy($filepath, Hyde::path('_site/media/'.basename($filepath)));
32+
copy($filepath, Hyde::getSiteOutputPath('media/'.basename($filepath)));
2933
}
3034
);
3135
$this->newLine(2);

0 commit comments

Comments
 (0)