swup swup Laravel Livewire Plugin
GitHub swup on GitHub

Laravel Livewire Plugin

Laravel Livewire doesn't work by default with Swup. The Livewire components work on initial page load but stop working on subsequent pages rendered by Swup. This plugin fixes this issue and brings support for Laravel Livewire to Swup.

Installation

This plugin can be installed with npm

npm install @swup/livewire-plugin
npm install @swup/livewire-plugin

and included with import

import SwupLivewirePlugin from '@swup/livewire-plugin';
import SwupLivewirePlugin from '@swup/livewire-plugin';

or included from the dist folder

<script src="./dist/SwupLivewirePlugin.js"></script>
<script src="./dist/SwupLivewirePlugin.js"></script>

Usage

To run this plugin, include an instance in the swup options.

const swup = new Swup({
  plugins: [new SwupLivewirePlugin()]
});
const swup = new Swup({
  plugins: [new SwupLivewirePlugin()]
});