Skip to content

Commit

Permalink
fix: update bareUI install steps
Browse files Browse the repository at this point in the history
  • Loading branch information
mychidarko committed Nov 12, 2023
1 parent 861c112 commit 846881a
Showing 1 changed file with 49 additions and 1 deletion.
50 changes: 49 additions & 1 deletion src/modules/views/bareui/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,62 @@ composer require leafs/bareui

## Usage with Leaf MVC

Leaf MVC and Leaf API come with [Leaf Blade](/modules/views/blade/) out of the box, however, since Leaf is modular at it's core, Leaf MVC and Leaf API allow you easily swap out the blade engine for BareUI (or any other view engine). To do this, you need to swap out the blade engine in your `public/index.php` and `config/view.php` files:
Leaf MVC and Leaf API come with [Leaf Blade](/modules/views/blade/) out of the box, however, since Leaf is modular at it's core, Leaf MVC and Leaf API allow you easily swap out the blade engine for BareUI (or any other view engine). To do this, you need to swap out the blade engine in your `public/index.php`:

```php
// public/index.php
Leaf\View::attach(\Leaf\Blade::class); // remove this
Leaf\View::attach(\Leaf\BareUI::class); // add this
```

After this, you will also need to change the config in `config/view.php`:

```php
<?php

use Leaf\View;

return [
/*
|--------------------------------------------------------------------------
| Template Engine [EXPERIMENTAL]
|--------------------------------------------------------------------------
|
| Leaf MVC unlike other frameworks tries to give you as much control as
| you need. As such, you can decide which view engine to use.
|
*/
'viewEngine' => \Leaf\BareUI::class,

/*
|--------------------------------------------------------------------------
| Custom config method
|--------------------------------------------------------------------------
|
| Configuration for your templating engine.
|
*/
'config' => function ($config) {
View::bareui()->config($config['views']);
},

/*
|--------------------------------------------------------------------------
| Custom render method
|--------------------------------------------------------------------------
|
| This render method is triggered whenever render() is called
| in your app if you're using a custom view engine.
|
*/
'render' => function ($view, $data = []) {
return View::bareui()->render($view, $data);
},
];
```

This will tell Leaf how to work with BareUI.

## Introduction

BareUI takes a fully static approach which means you can use all of it's methods without having to initilaize the package first. Also, there are only 2 things you need to keep in mind about Bare UI
Expand Down

0 comments on commit 846881a

Please sign in to comment.