previewEmail

previewEmail() renders your Svelte 5 component and launches the resulting HTML in a browser or logs it to the console.
OptionTypeDefaultDescription
componentSvelte Component-The Svelte component to render.
propsProps-The component’s input properties.
modebrowser | consolebrowserDetermines where the preview is shown.
optionsRenderOptions-See Render Options.
Render Options

Configure the rendering process with these options:

OptionTypeDefaultDescription
plainTextbooleantrueWhether to generate a plain-text version of the email.
beautifybooleantrueWhether to beautify the HTML output.
minifybooleantrueWhether to minify the HTML output.

Example

import MyEmail from './MyEmail.svelte';
import { previewEmail } from 'sailkit';

await previewEmail(
  MyEmail, // Svelte component
  { text: 'Hello World!' }, // Component props
  'browser' // Render in a new browser window
);