Skip to content

Commit e0586d6

Browse files
committed
feat: add vite reset for non-mvc apps
1 parent b39283f commit e0586d6

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

src/App.php

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,14 +182,13 @@ public function attach(callable $code)
182182
* Attach a view engine to Leaf
183183
* @param mixed $view The view engine to attach
184184
*/
185-
public function attachView($view)
185+
public function attachView($view, $name = null)
186186
{
187-
Config::attachView($view);
187+
Config::attachView($view, $name);
188188
}
189189

190190
/**
191191
* Evade CORS errors
192-
*
193192
* @param $options Config for cors
194193
*/
195194
public function cors($options = [])
@@ -201,6 +200,20 @@ public function cors($options = [])
201200
}
202201
}
203202

203+
/**
204+
* Tune vite to work without Leaf MVC
205+
*/
206+
public function vite($options = [
207+
'assets' => '',
208+
'build' => '',
209+
'hotFile' => 'hot'
210+
])
211+
{
212+
\Leaf\Vite::config('assets', $options['assets']);
213+
\Leaf\Vite::config('build', $options['build']);
214+
\Leaf\Vite::config('hotFile', $options['hotFile']);
215+
}
216+
204217
/**
205218
* Add CSRF protection to your app
206219
*
@@ -347,7 +360,7 @@ public static function script($mode, $callback)
347360
}
348361

349362
/**
350-
* Run mode-specific code. Unlike script, this runs immedietly.
363+
* Run mode-specific code. Unlike script, this runs immediately.
351364
*
352365
* @param string $mode The mode to run code in
353366
* @param callable $callback The code to run in selected mode.

0 commit comments

Comments
 (0)