Alpine Turbo Drive Adapter

screenshot of Alpine Turbo Drive Adapter
alpinejs

Bridge library to enable full support for Alpine components in pages using Turbolinks

Overview:

The Alpine Turbo Drive Adapter is a tool that allows you to add support for Alpine.js V3 to your Turbolinks/Turbo powered apps. It helps in handling events and cleaning up the DOM from Alpine generated code when navigating between pages.

Features:

  • Support for Alpine.js V3: Adds support for Alpine.js V3 to Turbolinks/Turbo powered apps.
  • Event Handling: Handles events to properly clean up the DOM from Alpine generated code when navigating between pages.
  • Compatibility with Turbolinks/Turbo: Works seamlessly with Turbolinks/Turbo powered apps.

From CDN:

Just include the following script tag before your Alpine script in your page:

<script src="https://cdn.jsdelivr.net/npm/alpine-turbo-drive-adapter@2.0.x/dist/alpine-turbo-drive-adapter.min.js" defer></script>

From NPM:

  1. Install the package using npm:
npm install alpine-turbo-drive-adapter
  1. Include it in your script along with Alpine JS (make sure Alpine is available on the window object). For example:
import Alpine from 'alpinejs'
import { TurboDriveAdapter } from 'alpine-turbo-drive-adapter'

window.Alpine = Alpine
window.Alpine.plugin(TurboDriveAdapter)

Alpine.start()

Summary:

The Alpine Turbo Drive Adapter is a useful tool for adding support for Alpine.js V3 to Turbolinks/Turbo powered apps. It handles events and cleans up the DOM from Alpine generated code when navigating between pages. The adapter can be easily installed from CDN or NPM and works seamlessly with Turbolinks/Turbo.

alpinejs
Alpine.js

Alpine.js is a lightweight JavaScript framework that simplifies the process of creating dynamic, reactive user interfaces on the web. It uses a declarative syntax that offers a higher level of abstraction compared to vanilla JavaScript, while being more performant and easier to use than jQuery.

eslint
Eslint

ESLint is a linter for JavaScript that analyzes code to detect and report on potential problems and errors, as well as enforce consistent code style and best practices, helping developers to write cleaner, more maintainable code.

rollup
Rollup

RollupJS is a popular and efficient JavaScript module bundler that takes the code from multiple modules and packages them into a single optimized file, minimizing the overall size of the application and improving its performance.