Skip to content

Commit ee2eea3

Browse files
committed
fix: patch up view:install command
1 parent 45d0789 commit ee2eea3

File tree

3 files changed

+41
-5
lines changed

3 files changed

+41
-5
lines changed

src/ViewInstallCommand.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,8 @@ protected function installBlade($output)
8282
$paths = require "$directory/config/paths.php";
8383
$viewsPath = trim($paths['views'] ?? 'app/views', '/');
8484

85-
\Leaf\FS::superCopy(__DIR__ . '/themes/blade', "$directory/$viewsPath");
86-
87-
$viewConfig = require "$directory/config/view.php";
88-
$viewConfig['viewEngine'] = '\Leaf\Blade';
89-
file_put_contents("$directory/config/view.php", '<?php return ' . var_export($viewConfig, true) . ';');
85+
\Leaf\FS::superCopy(__DIR__ . '/themes/blade/theme', "$directory/$viewsPath");
86+
\Leaf\FS::superCopy(__DIR__ . '/themes/blade/config', "$directory/config");
9087
} else {
9188
\Leaf\FS::superCopy(__DIR__ . '/themes/blade', $directory);
9289
}

src/themes/blade/config/view.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
use Leaf\View;
4+
5+
return [
6+
/*
7+
|--------------------------------------------------------------------------
8+
| Template Engine [EXPERIMENTAL]
9+
|--------------------------------------------------------------------------
10+
|
11+
| Leaf MVC unlike other frameworks tries to give you as much control as
12+
| you need. As such, you can decide which view engine to use.
13+
|
14+
*/
15+
'viewEngine' => \Leaf\Blade::class,
16+
17+
/*
18+
|--------------------------------------------------------------------------
19+
| Custom config method
20+
|--------------------------------------------------------------------------
21+
|
22+
| Configuration for your templating engine.
23+
|
24+
*/
25+
'config' => function ($config) {
26+
View::blade()->configure($config['views'], $config['cache']);
27+
},
28+
29+
/*
30+
|--------------------------------------------------------------------------
31+
| Custom render method
32+
|--------------------------------------------------------------------------
33+
|
34+
| This render method is triggered whenever render() is called
35+
| in your app if you're using a custom view engine.
36+
|
37+
*/
38+
'render' => null,
39+
];

0 commit comments

Comments
 (0)