From 0359223d4634738644dd352a3cea39c27e2bf227 Mon Sep 17 00:00:00 2001 From: aspizu Date: Mon, 10 Mar 2025 03:26:07 +0530 Subject: feat: allow customizing layout import source, or fallback to using no layout without throwing an error --- src/index.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/index.ts') 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)], }, }) }, -- cgit v1.2.3