Drupal is a registered trademark of Dries Buytaert
drupal 11.3.7 Update released for Drupal core (11.3.7)! drupal 11.2.11 Update released for Drupal core (11.2.11)! drupal 10.6.7 Update released for Drupal core (10.6.7)! drupal 10.5.9 Update released for Drupal core (10.5.9)! cms 2.1.1 Update released for Drupal core (2.1.1)! drupal 11.3.6 Update released for Drupal core (11.3.6)! drupal 10.6.6 Update released for Drupal core (10.6.6)! cms 2.1.0 Update released for Drupal core (2.1.0)! bootstrap 8.x-3.40 Minor update available for theme bootstrap (8.x-3.40). menu_link_attributes 8.x-1.7 Minor update available for module menu_link_attributes (8.x-1.7). eca 3.1.1 Minor update available for module eca (3.1.1). layout_paragraphs 2.1.3 Minor update available for module layout_paragraphs (2.1.3). ai 1.3.3 Minor update available for module ai (1.3.3). ai 1.2.14 Minor update available for module ai (1.2.14). node_revision_delete 2.0.3 Minor update available for module node_revision_delete (2.0.3). moderated_content_bulk_publish 2.0.52 Minor update available for module moderated_content_bulk_publish (2.0.52). klaro 3.0.10 Minor update available for module klaro (3.0.10). klaro 3.0.9 Minor update available for module klaro (3.0.9). layout_paragraphs 2.1.2 Minor update available for module layout_paragraphs (2.1.2). geofield_map 11.1.8 Minor update available for module geofield_map (11.1.8).

alpine_js

80 sites Security covered
View on drupal.org

Drupal 💙 Alpine.js

How to use

This module exclusively uses the Drupal Library system to find and process javascript files that are either a Alpine Plugin or a script that needs to be loaded before Alpine.start is executed.

You can added globally for your entire theme by setting it as dependency in your theme.info.yml file

type: theme
libraries:
  - alpine_js/alpine_js

Or if you created a module or a single script that requires javascript by adding an attribute on your library definition.

drupal.alpine_plugin:
  version: VERSION
  js:
    js/drupal.itemsjs.js: { attributes: { alpine_js: true } }
  dependencies:
    - alpine_js/alpine_js

Alpine Plugin

If your code is an Alpine.js plugin you need to implement a listener for alpine:init event.

const myPlugin = function (Alpine) {
  Alpine.directive('directive',(el) => {
    // The actual code of your directive
  });
}

document.addEventListener('alpine:init', () => {
    window.Alpine.plugin(myPlugin);
})

Changelog

3.0.7

  • Fixed issue with AJAX/XHR requests by Lukus
  • Updated AlpineJS and plugins to 3.15.8 Changelog

3.0.6

  • Updated AlpineJS and plugins to 3.15.1
  • Experimentally set AlpineJS and its plugins to weight 300 to make sure they are loaded last.

3.0.5

  • Fixed issue with missing licences on Alpine Base libraries after the findAndSplitAlpineLibraries function was run
  • Added AlpineJS plugin Resize to the bundled plugins

3.0.4

  • Removed the double require of drupal/core from composer.json

3.0.3

  • Updated AlpineJS and plugins to 3.14.8
  • The global attachment code was causing some issues being loaded on admin route pages. On new installations it is disabled by default. With an explicit option to load it on a admin page if you need to. Instead of enabling AlpineJS globally you can use the two options mentioned in the How to use section above.

3.0.2

  • Fixed bug, Global attachment of AlpineJS was ignored.
  • Upgraded AlpineJS and AlpineJS-CSP to 3.13.5

3.0.1

  • Upgraded AlpineJS and AlpineJS-CSP to 3.13.3
  • Added Official Alpine Plugins anchor, collapse, focus, intersect and persist
  • Added option to fully disable loading AlpineJS unless it's required by either attach_library, libraries.yml in a theme or as dependencies on another library
  • Removed the need to add alpine_js/alpine to your library definition if the attributes: { alpinejs: true} is added to one of the javascript files on your library
  • Attachment order of Alpine, Plugin and your libary files is Alpine Plugins -> Custom defined plugins -> AlpineJS or AlpineJS-CSP
  • Added Links to the Plugin documentation on the settings screen
  • This version might work on Drupal 9.5, but is only tested on Drupal 10.x

3.0.0

  • Tagged first release, we have been using this in production for the 1st quarter of 2023 without any issues.
  • Upgraded AlpineJS and AlpineJS-CSP to 3.12.0
  • Fixed a regression issue in the UI showing a false state that CSP version was enabled if you updated from an older dev release.
  • Dropped support for EOL Drupal version (9.3 and earlier)
  • Updated minimal PHP to 8.0 in composer.json as 7.4 is EOL

Activity

Total releases
5
First release
Jan 2025
Latest release
1 month ago
Release cadence
103 days
Stability
100% stable

Release Timeline

Releases

Version Type Release date
3.0.7 Stable Mar 9, 2026
3.0.6 Stable Nov 4, 2025
3.0.5 Stable Feb 11, 2025
3.0.4 Stable Feb 3, 2025
3.0.3 Stable Jan 20, 2025