github withastro/astro @astrojs/alpinejs@0.4.0

latest releases: astro@5.0.0-beta.8, astro@4.16.12, astro@4.16.11...
9 months ago

Minor Changes

  • #9751 1153331cbbaa66a88645d15c6e949432210d4acc Thanks @florian-lefebvre! - Allows extending Alpine using the new entrypoint configuration

    You can extend Alpine by setting the entrypoint option to a root-relative import specifier (for example, entrypoint: "/src/entrypoint").

    The default export of this file should be a function that accepts an Alpine instance prior to starting, allowing the use of custom directives, plugins and other customizations for advanced use cases.

    // astro.config.mjs
    import { defineConfig } from 'astro/config';
    import alpine from '@astrojs/alpinejs';
    
    export default defineConfig({
      // ...
      integrations: [alpine({ entrypoint: '/src/entrypoint' })],
    });
    // src/entrypoint.ts
    import type { Alpine } from 'alpinejs'
    
    export default (Alpine: Alpine) => {
        Alpine.directive('foo', el => {
            el.textContent = 'bar';
        })
    }

Don't miss a new astro release

NewReleases is sending notifications on new releases.