@aaronellington/vite-plugin-inkwell
v0.2.2
Published
A Vite plugin that transforms directories of markdown files into typed, lazy-loaded content collections with frontmatter parsing, asset hashing, and HMR.
Maintainers
Readme
@aaronellington/vite-plugin-inkwell
A Vite plugin that transforms directories of markdown files into typed, lazy-loaded content collections with frontmatter parsing, asset hashing, and HMR.
Setup
Install the plugin:
npm install @aaronellington/vite-plugin-inkwellRegister it in vite.config.ts:
import { inkwell } from "@aaronellington/vite-plugin-inkwell";
export default defineConfig({
plugins: [inkwell()],
});For TypeScript support of inkwell:* imports, add a reference in a .d.ts file (e.g. env.d.ts):
/// <reference types="@aaronellington/vite-plugin-inkwell/types" />Usage
Import a content directory using the inkwell: prefix. The path resolves relative to the importing file:
import collection from "inkwell:./content";Multiple collections are supported:
import blog from "inkwell:./blog";
import tutorials from "inkwell:./tutorials";Draft Mode
Posts with draft: true are excluded from production builds but included during development. Override with the includeDrafts option.
HMR
Editing or adding markdown files triggers a full page reload in development. The plugin watches all imported content directories automatically.
