preview

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2025 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadTemplate

func LoadTemplate(path string) (*template.Template, error)

LoadTemplate parses and caches an HTML template file by its path.

If the template has been parsed before, it returns the cached version. Otherwise, it loads and parses the template and stores it in memory.

func RenderTemplate

func RenderTemplate(recipient parser.Recipient, templatePath string) (string, error)

RenderTemplate renders an HTML template with the given recipient's data.

It uses caching internally for performance. Recipient values can be accessed in the template via:

  • {{ .Email }} for the top-level email
  • {{ .Data.name }}, {{ .Data.age }}, etc. for CSV fields

func StartServer

func StartServer(rendered string, port int) error

StartServer starts a local HTTP server to preview the rendered email. Returns an error if the server fails to start or serve.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL