Install this package by running:
composer require laravel-views/laravel-views
It is also necessary to publish some assets to your resources directory.
php artisan vendor:publish --tag=public --provider='LaravelViews\LaravelViewsServiceProvider' --force
Add the following Blade directives in the head tag, and before the end of the body tag in your template.
<html> <head> ... @laravelViewsStyles </head> <body> ... @laravelViewsScripts </body> </html>
Laravel Views includes by default a set up using different parts of the TALL stack like the Laravel livewire and Tailwindcss styles and scripts, it alsoincludes the Alpine.js script, after adding these directives you may need to clear the view cache
php artisan view:clear
These directives are fine for a dev environment, however, it is recommended to use your own Tailwindcss and Alpinde.js setup.
You can specify which assets you want to include passing a string to those directives with a list of the assets you want to include.
If you dont need to include
Alpine assets you can just set the
laravel-views assets in the list.
This is recomended for a production environment where you surely have a compile assets pipeline, like Laravel Mix, or you want to include the assets from a CDN on your own.
Purge Tailwindcss styles
If you're using your own Tailwindcss setup you must consider
laravel-views in your
purge configuration, for that just add this path to the
purge array on the