Skip to content

Commit 7f4fd91

Browse files
committed
Update README.md
1 parent 65b415d commit 7f4fd91

File tree

1 file changed

+9
-23
lines changed

1 file changed

+9
-23
lines changed

README.md

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -35,41 +35,27 @@ Blaze is designed as a drop-in replacement for anonymous Blade components. It su
3535
> [!IMPORTANT]
3636
> When using `@aware`, both the parent and child must use Blaze for the values to propagate correctly.
3737
38-
### Usage
38+
### Getting started
3939

40-
Enable Blaze in your `AppServiceProvider`.
41-
42-
This will optimize all [anonymous component paths](https://laravel.com/docs/12.x/blade#anonymous-component-paths).
40+
Enable Blaze in your `AppServiceProvider`:
4341

4442
```php
4543
use Livewire\Blaze\Blaze;
4644

47-
/**
48-
* Bootstrap any application services.
49-
*/
5045
public function boot(): void
5146
{
5247
Blaze::optimize();
5348
}
5449
```
5550

56-
> [!CAUTION]
57-
> This can break your app if you rely on features not supported by Blaze. Consider only enabling Blaze for certain directories or components.
58-
59-
### Configuration
60-
61-
To only enable Blaze for specific directories or components:
62-
63-
**Define component paths:**
51+
This optimizes all [anonymous component paths](https://laravel.com/docs/12.x/blade#anonymous-component-paths). You can also scope Blaze to specific directories or enable it per-component:
6452

6553
```php
6654
Blaze::optimize()
6755
->in(resource_path('views/components/icons'))
6856
->in(resource_path('views/components/ui'));
6957
```
7058

71-
**Or use the @blaze directive:**
72-
7359
```blade
7460
@blaze
7561
@@ -78,7 +64,7 @@ Blaze::optimize()
7864
</button>
7965
```
8066

81-
To enable different strategies per directory/component:
67+
Different [optimization strategies](#optimization-strategies) can be enabled per directory or component:
8268

8369
```php
8470
Blaze::optimize()
@@ -93,13 +79,13 @@ Blaze::optimize()
9379

9480
## Optimization strategies
9581

96-
Blaze offers three optimization strategies:
82+
By default, Blaze uses function compilation - a reliable strategy that behaves identically to standard Blade but eliminates 91-97% of the rendering overhead. For specific scenarios, two optional strategies can be enabled per-component or directory:
9783

9884
| Strategy | Param | When to use |
99-
|----------|----------|-------------|
100-
| **[Compiler](#function-compiler)** | (default) | For most components - reliable optimization with zero concerns about caching or stale data |
101-
| **[Memoization](#runtime-memoization)** | `memo` | For self-closing components like icons or avatars that appear many times on a page with the same props |
102-
| **[Folding](#compile-time-folding)** | `fold` | For maximum performance - when you understand the folding model and your component's data flow |
85+
|----------|-------|-------------|
86+
| **[Compiler](#function-compiler)** | (default) | General use - works like Blade, 91-97% faster |
87+
| **[Memoization](#runtime-memoization)** | `memo` | Icons/avatars repeated with same props |
88+
| **[Folding](#compile-time-folding)** | `fold` | Static components - maximum performance |
10389

10490
## Function compiler
10591

0 commit comments

Comments
 (0)