Laravel Blade Emerald provides Emmet-like abbreviations to generate and wrap Laravel Blade components with markup. It works by using an <x-markup/>
Blade component that accepts an Emmet abbreviation:
1<x-markup make="div.col>div.alert.alert-success[role=alert]"> 2 <strong>Success !</strong> give it a click if you like. 3</x-markup> 4 5{{-- Generated HTML --}} 6 7<div class="col"> 8 <div class="alert alert-success" role="alert"> 9 <strong>Success !</strong> give it a click if you like.10 </div>11</div>
This package makes it easy and convenient to achieve nested markup via Emmet-style code and even around existing content or other components. You can also use the Markup
trait provided by this package to wrap other Blade components using Emmet syntax:
1use Aqua\Emerald\Traits\Markup; 2 3class YourComponent extends Component 4{ 5 use Markup; 6 7 public function __construct(public $wrap) {...} 8 9 // ...10}
Now you can use abbreviations that will wrap your component:
1<x-your-component wrap=".card.bg-dark.pt-2 > .card-body.text-danger" />
Check out the useful examples for further inspiration of how you can use this package with Bootstrap, Alpine, or any other HTML output needs.
You can learn more about this package, get full installation instructions, and view the source code on GitHub.
0 comments:
Post a Comment
Thanks