mirror of
https://github.com/xtr-dev/payload-mailing.git
synced 2025-12-10 08:13:23 +00:00
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:
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user