diff options
| author | aspizu <aspizu@protonmail.com> | 2025-03-10 03:26:07 +0530 |
|---|---|---|
| committer | aspizu <aspizu@protonmail.com> | 2025-03-10 03:26:07 +0530 |
| commit | 0359223d4634738644dd352a3cea39c27e2bf227 (patch) | |
| tree | e3fe667a4354af8f0c879d0548232142138852da /src/index.ts | |
| parent | 595673bae6dcdcf2f5c13ce15efaa535e011b894 (diff) | |
feat: allow customizing layout import source, or fallback to using no layout without throwing an error
Diffstat (limited to 'src/index.ts')
| -rw-r--r-- | src/index.ts | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/index.ts b/src/index.ts index 27ed46a..8bbb51b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,6 +4,10 @@ import gemtextVitePlugin from "./vitePlugin.js" export const ext = "gmi" +export interface GemtextConfig { + layout?: string +} + type SetupHookParams = HookParameters<"astro:config:setup"> & { // `addPageExtension` and `contentEntryType` are not a public APIs // Add type defs here @@ -11,7 +15,10 @@ type SetupHookParams = HookParameters<"astro:config:setup"> & { addContentEntryType: (contentEntryType: ContentEntryType) => void } -export default function gemtext(): AstroIntegration { +export default function gemtext(config: GemtextConfig): AstroIntegration { + if (!config.layout) { + config.layout = "/src/layouts/Layout.astro" + } return { name: "astro-gemtext", hooks: { @@ -32,7 +39,7 @@ export default function gemtext(): AstroIntegration { }) params.updateConfig({ vite: { - plugins: [gemtextVitePlugin()], + plugins: [gemtextVitePlugin(config)], }, }) }, |
