@imprint-pdf/vite
v1.0.0-alpha.5
Published
Vite plugin for imprint-pdf — compile-time Tailwind extraction, HMR, and virtual font modules.
Readme
@imprint-pdf/vite
Vite plugin for imprint-pdf —
compile-time Tailwind extraction and HMR in the imprint dev preview server.
pnpm add -D @imprint-pdf/vite viteSetup
// vite.config.ts
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { imprint } from '@imprint-pdf/vite';
export default defineConfig({
plugins: [
react(),
imprint({
// optional: path to imprint.config.ts
config: './imprint.config.ts',
}),
],
});What it does
- Runs Tailwind v4 Oxide over your source files at build time and injects the resolved CSS map into the imprint-pdf render pipeline.
- Provides a virtual
@imprint-pdf/virtual/fontsmodule so font files are imported cleanly withoutfscalls in browser builds. - Integrates with
vite --watchfor HMR — change a template, theimprint devpreview reloads instantly. - Handles WASM asset copying and
?urlimports for the standalone Cloudflare Workers build.
Options
imprint({
config?: string; // path to imprint.config.ts (default: auto-detect)
tailwind?: {
stylesheet?: string; // Tailwind v4 CSS entry. Auto-detected from src/app.css,
// src/globals.css, app/globals.css, etc.
runtimeFallback?: boolean; // enable Oxide WASM fallback for dynamic classes (default: false)
};
wasm?: {
inline?: boolean; // base64-inline WASM in the bundle (default: false)
};
})