File tree 2 files changed +35
-0
lines changed
2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ class HydeBuildStaticSiteCommand extends Command
36
36
{--run-dev : Run the NPM dev script after build}
37
37
{--run-prod : Run the NPM prod script after build}
38
38
{--pretty : Should the build files be prettified?}
39
+ {--pretty-urls : Should links in output use pretty URLs?}
39
40
{--no-api : Disable external API calls, such as Torchlight} ' ;
40
41
41
42
/**
@@ -97,6 +98,12 @@ protected function printInitialInformation(): void
97
98
unset($ config [array_search ('torchlight ' , $ config )]);
98
99
Config::set (['hyde.features ' => $ config ]);
99
100
}
101
+
102
+ if ($ this ->option ('pretty-urls ' )) {
103
+ $ this ->info ('Generating site with pretty URLs ' );
104
+ $ this ->newLine ();
105
+ Config::set (['hyde.prettyUrls ' => true ]);
106
+ }
100
107
}
101
108
102
109
/** @internal */
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Tests \Unit ;
4
+
5
+ use Hyde \Framework \Hyde ;
6
+ use Tests \TestCase ;
7
+
8
+ /**
9
+ * Class TestBuildStaticSiteCommandFlagToEnablePrettyUrls.
10
+ */
11
+ class TestBuildStaticSiteCommandFlagToEnablePrettyUrls extends TestCase
12
+ {
13
+ public function test_pretty_urls_can_be_enabled_with_flag ()
14
+ {
15
+ config (['hyde.prettyUrls ' => false ]);
16
+
17
+ $ this ->artisan ('build --pretty-urls ' )
18
+ ->expectsOutput ('Generating site with pretty URLs ' )
19
+ ->assertExitCode (0 );
20
+
21
+ $ this ->assertTrue (config ('hyde.prettyUrls ' , false ));
22
+ }
23
+
24
+ public function test_config_change_is_not_persisted ()
25
+ {
26
+ $ this ->assertFalse (config ('hyde.prettyUrls ' , false ));
27
+ }
28
+ }
You can’t perform that action at this time.
0 commit comments