Skip to content
Inkoxide

Search covers every page and heading of the docs. Use ↑ ↓ and ↵.

On a server

Edit this page

renderToBuffer, renderToFile and renderToStream take a VNode (h(Invoice, { invoice })) or a component. A server build (Vite's SSR, Vitest in Node, a Nuxt app's server bundle) compiles .vue files to render HTML strings, which Inkoxide cannot use; @inkoxide/vue/vite compiles the templates for the client in it:

// vite.config.ts, or nuxt.config.ts's vite.plugins for the app's code
import vue from '@vitejs/plugin-vue';
import { pdfTemplates } from '@inkoxide/vue/vite';

export default defineConfig({ plugins: [pdfTemplates(vue(), /\/pdf\//)] });

The second argument picks the template files; without it, every .vue file is compiled for the client. Templates written as render functions or JSX need nothing. Nuxt's server routes (server/) are built by Nitro, which does not compile .vue files: the templates they render are render functions.

Synced from packages/vue/GUIDE.md in the inkoxide repository.