Replace Handlebars with flexible template engine system

- Replace handlebars dependency with optional liquidjs and mustache
- Add templateEngine string configuration ('liquidjs', 'mustache', 'simple')
- Add custom templateRenderer hook for maximum flexibility
- Implement graceful fallbacks when optional dependencies unavailable
- Fix webpack compatibility issues with require.extensions
- Maintain backward compatibility with existing templates
- Add comprehensive template syntax documentation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-09-13 17:51:25 +02:00
parent 243f7c96cf
commit dc3c4fdb44
5 changed files with 295 additions and 81 deletions

View File

@@ -16,6 +16,10 @@ export interface EmailObject {
export type EmailWrapperHook = (email: EmailObject) => EmailObject | Promise<EmailObject>
export type TemplateRendererHook = (template: string, variables: Record<string, any>) => string | Promise<string>
export type TemplateEngine = 'liquidjs' | 'mustache' | 'simple'
export interface MailingPluginConfig {
collections?: {
templates?: string | Partial<CollectionConfig>
@@ -28,6 +32,8 @@ export interface MailingPluginConfig {
retryAttempts?: number
retryDelay?: number
emailWrapper?: EmailWrapperHook
templateRenderer?: TemplateRendererHook
templateEngine?: TemplateEngine
richTextEditor?: RichTextField['editor']
onReady?: (payload: any) => Promise<void>
initOrder?: 'before' | 'after'