In this Laravel alpine js tutorial, I will show you how to set up alpine js in the Laravel 8 application. We can set up alpine js in two ways in our laravel application. One is using CDN and the other is from npm or yarn.
Install alpine js via CDN in Laravel 8 application:
Install alpine js via npm in Laravel 8 application:
yarn add alpinejs // for npm npm install alpinejs
Then update below file like:
Keep in mind that in order to initialize Alpine Js version 3 you have to call the
Alpine.start() like below:
import Alpine from 'alpinejs'; window.Alpine = Alpine; Alpine.start();
Now we can run
run watch or compile it to production with
yarn watch yarn prod
Read also: Complete Beginners Guide on Laravel Livewire Events
Hope this how to install Alpine js in Laravel 8 tutorial will help you to set up alpine js in Laravel.
#laravel #laravel-8x #alpine-js #livewire