mirror of
https://github.com/withastro/astro.git
synced 2024-12-23 21:53:55 -05:00
17 lines
481 B
TypeScript
17 lines
481 B
TypeScript
import type { AstroIntegration } from 'astro';
|
|
|
|
export default function createPlugin(): AstroIntegration {
|
|
return {
|
|
name: '@astrojs/alpinejs',
|
|
hooks: {
|
|
'astro:config:setup': ({ injectScript }) => {
|
|
// This gets injected into the user's page, so the import will pull
|
|
// from the project's version of Alpine.js in their package.json.
|
|
injectScript(
|
|
'page',
|
|
`import Alpine from 'alpinejs'; window.Alpine = Alpine; Alpine.start();`
|
|
);
|
|
},
|
|
},
|
|
};
|
|
}
|