arillo/silverstripe-cms-alpine

Makes alpinejs available in silverstripe CMS

Installs: 905

Dependents: 2

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 0

Open Issues: 0

Type:silverstripe-vendormodule

dev-main 2023-08-21 13:40 UTC

This package is auto-updated.

Last update: 2024-11-21 16:16:38 UTC


README

Loads alpinejs into CMS.

To instantiate you alpine components, you need to listen for the alpine:init event like this:

/* global Alpine */

const component = {
  init() {
    console.log('yourComponent.init');
  }
};

if (typeof Alpine !== 'undefined') {
  Alpine.data('yourComponent', component);
}
document.addEventListener('alpine:init', () => {
  Alpine.data('yourComponent', component);
});

Currently only alpinejs@3.12.3_dist_cdn.min.js is available, support for other versions might come in future.