0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-23 21:53:55 -05:00
astro/packages/integrations/turbolinks/src/index.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
552 B
TypeScript
Raw Normal View History

import type { AstroIntegration } from 'astro';
export default function createPlugin(): AstroIntegration {
return {
name: '@astrojs/turbolinks',
hooks: {
'astro:config:setup': ({ injectScript }) => {
// This gets injected into the user's page, so we need to re-export Turbolinks
// from our own package so that package managers like pnpm don't get mad and
// can follow the import correctly.
injectScript(
'page',
`import {Turbolinks} from "@astrojs/turbolinks/client.js"; Turbolinks.start();`
);
},
},
};
}