UNPKG

@ztl-uwu/nuxt-content

Version:

Write your content inside your Nuxt app

16 lines (15 loc) 476 B
import { useStorage, defineNitroPlugin } from "#imports"; export default defineNitroPlugin(async (nitro) => { const { cleanCachedContents } = await import("../storage.js"); const storage = useStorage(); const unwatch = await storage.watch(async (event, key) => { if (key.startsWith("content:source")) { cleanCachedContents(); } }); nitro.hooks.hook("close", async () => { if (typeof unwatch === "function") { await unwatch(); } }); });