Skip to content

Commit 2584f86

Browse files
committed
fix: remove conflicting docs
1 parent 4adc120 commit 2584f86

File tree

5 files changed

+61
-25
lines changed

5 files changed

+61
-25
lines changed

src/docs/frontend/bareui.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,18 @@ composer require leafs/bareui
3939

4040
:::
4141

42-
Once installed, BareUI will be available in your Leaf app on the `bareui()` method. This makes it easy to use BareUI from anywhere in your app.
42+
Once installed, BareUI will be available in your Leaf app on the `template()` method. This makes it easy to use BareUI from anywhere in your app.
4343

44-
```php
45-
app()->bareui()->render('welcome');
44+
```php:no-line-numbers
45+
app()->template()->render('welcome');
4646
```
4747

4848
## Configuring BareUI
4949

5050
BareUI doesn't require any real configuration to work, but you need to tell it where to look for your templates. You can do this using the `config()` method. If you are using Leaf MVC, this has already been done for you in the `config/view.php` file, so you can skip this step.
5151

52-
```php
53-
app()->bareui()->config('path', './views');
52+
```php:no-line-numbers
53+
app()->template()->config('path', './views');
5454
```
5555

5656
This will tell BareUI to look for templates in the `views` directory in your project. Now that BareUI knows where to look for templates, you can start writing your templates.
@@ -82,8 +82,8 @@ BareUI templates are regular PHP files, so you can create your templates using P
8282

8383
Once you have your template, you can render it using the `render` method. This method takes in the name of the template to render and an array of data to pass to the template.
8484

85-
```php
86-
echo app()->bareui()->render('welcome');
85+
```php:no-line-numbers
86+
echo app()->template()->render('welcome');
8787
```
8888

8989
When rendering a template, you don't need to include the `.view.php` extension in the template name. BareUI automatically adds it for you when it looks for the template file. So, you only need to pass the name of the template without the extension, and BareUI will handle the rest!
@@ -118,15 +118,15 @@ This is an empty HTML page with a PHP tag that echoes a variable. On its own, th
118118
To pass data to this `$name` variable, you can pass an array of data as the second argument to the `render()` method. This array should contain the same keys as the variables you want to use in the template.
119119

120120
```php
121-
echo app()->bareui()->render('welcome', [
121+
echo app()->template()->render('welcome', [
122122
'name' => 'Something',
123123
]);
124124
```
125125

126126
This will render the template and replace the `$name` variable with the value `'Something'`. You can pass as many variables as you want to the template, and they will all be available in the template file. These values can be anything from strings to arrays, objects, or even functions.
127127

128128
```php [app.php]
129-
echo app()->template->render('products', [
129+
echo app()->template()->render('products', [
130130
'items' => [
131131
['name' => 'Item 1'],
132132
['name' => 'Item 2'],
@@ -197,7 +197,7 @@ BareUI supports all the control structures you'd expect in a templating engine.
197197

198198
As you guessed, any valid PHP code can be used in BareUI templates. This means you can use any PHP function, class, or method in your templates. This makes BareUI a powerful templating engine that can handle any task you throw at it.
199199

200-
## Sub-templates
200+
## Sub-templates/Partials
201201

202202
Sub-templates are templates that are included in other templates. This allows you to break your templates into smaller, more manageable pieces that can be reused across multiple templates. This is a great way to keep your templates DRY and avoid repeating yourself.
203203

src/docs/frontend/blade.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,13 @@ This video by The Net Ninja will help you get started with blade.
2525

2626
## Setting Up
2727

28-
Blade comes with Leaf MVC out of the box, fully configured and ready to use. However, if you're using Leaf Core, you'll need to set up Blade yourself. Don't worry, it's pretty easy. All you need to do is install Blade, configure it to match your project's setup, and you're good to go.
28+
::: info Blade + Leaf MVC
2929

30-
You can install Leaf Blade with the Leaf CLI:
30+
Blade comes with Leaf MVC out of the box, fully configured and ready to use. However, if you're using Leaf Core, you'll need to set up Blade yourself.
31+
32+
:::
33+
34+
You can install Leaf Blade using the Leaf CLI:
3135

3236
::: code-group
3337

@@ -43,7 +47,7 @@ composer require leafs/blade
4347

4448
After this, you just need to inform Leaf of Blade's existence:
4549

46-
```php
50+
```php:no-line-numbers
4751
app()->attachView(Leaf\Blade::class);
4852
```
4953

@@ -87,7 +91,7 @@ This should look pretty familiar if you know HTML (of course you do). The only d
8791

8892
Remember we set up Blade earlier? Now we can use it to render our Blade views. Here's how you can render the `hello.blade.php` view we created earlier:
8993

90-
```php
94+
```php:no-line-numbers
9195
echo app()->blade()->render('hello', ['name' => 'Michael']);
9296
```
9397

@@ -105,7 +109,7 @@ app()->blade()->directive('datetime', function ($expression) {
105109

106110
Which allows you to use the following in your blade template:
107111

108-
```html
112+
```blade:no-line-numbers
109113
Current date: @datetime($date)
110114
```
111115

src/docs/frontend/tailwind.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,22 @@ That's it! You now have Tailwind CSS set up in your Leaf project. You can start
103103
104104
Be sure to start your vite server by running:
105105
106-
```bash:no-line-numbers
107-
npm run dev
106+
::: code-group
107+
108+
```bash:no-line-numbers [Leaf CLI]
109+
leaf view:dev
110+
```
111+
112+
```bash:no-line-numbers [npm]
113+
npm i && npm run dev
108114
```
115+
116+
```bash:no-line-numbers [pnpm]
117+
pnpm i && pnpm run dev
118+
```
119+
120+
```bash:no-line-numbers [yarn]
121+
yarn && yarn dev
122+
```
123+
124+
:::

src/docs/frontend/third-party.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ composer require smarty/smarty
2020

2121
Once installed, you need to tell Leaf about your engine. Leaf will try to cache your engine for future use. You can do this using the `attachView()` method on the app instance:
2222

23-
```php
23+
```php:no-line-numbers
2424
app()->attachView(Smarty::class);
2525
```
2626

@@ -48,7 +48,7 @@ Unlike Leaf Core, Leaf MVC comes with a view manager that makes Leaf aware of an
4848

4949
The first step is to head over to your `public/index.php` file and attach Smarty to Leaf:
5050

51-
```php
51+
```php:no-line-numbers
5252
app()->attachView(Smarty::class);
5353
```
5454

src/docs/frontend/vite.md

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,32 @@ Once you've installed Vite, you can start loading your assets using the the `vit
7373

7474
Here's an example of how you can load a CSS file:
7575

76-
```php
76+
::: code-group
77+
78+
```blade:no-line-numbers [Blade]
79+
{{ vite('css/app.css') }}
80+
```
81+
82+
```php:no-line-numbers [BareUI]
7783
<?php echo vite('css/app.css'); ?>
7884
```
7985

86+
:::
87+
8088
You can also load multiple assets at once by passing in an array of assets:
8189

82-
```php
90+
::: code-group
91+
92+
```blade:no-line-numbers [Blade]
93+
{{ vite(['app.css', 'app.js']) }}
94+
```
95+
96+
```php:no-line-numbers [BareUI]
8397
<?php echo vite(['app.css', 'app.js']); ?>
8498
```
8599

100+
:::
101+
86102
The `vite()` helper function will automatically load the correct assets depending on the environment. In development, it will load the assets from the vite server with Hot Module Replacement, while in production, it will load the assets from the build folder.
87103

88104
## Vite Config
@@ -108,7 +124,7 @@ export default defineConfig({
108124

109125
The Leaf Vite plugin requires an array of entry points for your application. These may be JavaScript or CSS files, and include preprocessed languages such as TypeScript, JSX, and Sass. You don't need to pass all your assets here, just the entry points.
110126

111-
Besides the Vite config file, you can also configure the server component for Vite. With this, you can set a couple of defaults for your assets.
127+
Besides the Vite config file, you can also configure the server component to set a few defaults for Vite. This is is only necessary if you are NOT using Leaf MVC. You can configure the server component by calling the `config` method on the `Vite` class:
112128

113129
```php
114130
\Leaf\Vite::config([
@@ -119,11 +135,9 @@ Besides the Vite config file, you can also configure the server component for Vi
119135

120136
Unlike the `vite.config.js` file, this configuration is done in PHP and is completely optional.
121137

122-
Once again if you're using Leaf MVC or if you installed Vite using the `view:install` command, this is done for you automatically.
123-
124138
## Running Vite
125139

126-
Vite comes with a development server that you can use to serve your assets. This is true for the Leaf Vite integration as well. This is a bit different from the traditional way of serving assets with PHP because you need to run a separate server for your assets. You can start your Vite server by running:
140+
Vite comes with a development server that you can use to serve your frontend assets. This is a bit different from the traditional way of serving assets with PHP because you need to run a separate server for your assets. You can start your Vite server by running:
127141

128142
::: code-group
129143

@@ -147,6 +161,8 @@ yarn && yarn dev
147161

148162
This will install the necessary dependencies and start your Vite server. You don't need to do anything with the Vite server, just keep it running in the background and Leaf will take care of the rest.
149163

164+
**You need to keep the Vite server running in a separate terminal window while you work on your project.**
165+
150166
## Adding Aliases
151167

152168
Vite allows you to set up aliases for your assets. This can be done by adding an `alias` key to your vite config. For example, to set up an alias for the `@` symbol, you can do:

0 commit comments

Comments
 (0)