ReactEmailEngine
Class: ReactEmailEngine
Defined in: packages/react-email/src/engine.ts:40
Template engine rendering react-email components
Implements
TemplateEngine
Constructors
Constructor
new ReactEmailEngine():
ReactEmailEngine
Returns
ReactEmailEngine
Properties
extensions
extensions:
string[]
Defined in: packages/react-email/src/engine.ts:41
File extensions handled by the engine (without the dot)
Implementation of
TemplateEngine.extensions
memo
protectedmemo:Memo
Defined in: packages/react-email/src/engine.ts:43
options
protectedoptions:ReactEmailEngineOptions
Defined in: packages/react-email/src/engine.ts:42
Methods
compile()
compile():
CompiledTemplate
Defined in: packages/react-email/src/engine.ts:58
Not supported: react-email templates are modules
Returns
CompiledTemplate
Implementation of
TemplateEngine.compile
configure()
configure(
options?):void
Defined in: packages/react-email/src/engine.ts:49
Configure the engine
Parameters
options?
engine options
Returns
void
Implementation of
TemplateEngine.configure
load()
load(
path,options?):Promise<CompiledTemplate>
Defined in: packages/react-email/src/engine.ts:88
Load an email module
Parameters
path
string
the module path
options?
TemplateRenderOptions
load options, part selects the part rendered
Returns
Promise<CompiledTemplate>
the compiled template
Implementation of
TemplateEngine.load
parts()
parts(
path):Promise<string[]>
Defined in: packages/react-email/src/engine.ts:69
List the parts of an email module
A module without a default export component (a shared helper) has no part, so it is not a template
Parameters
path
string
the module path
Returns
Promise<string[]>
the parts
Implementation of
TemplateEngine.parts
rendered()
protectedrendered(component,data,locale?):Promise<RenderedEmail>
Defined in: packages/react-email/src/engine.ts:108
Render once per component, data object and locale
Each entry keeps a JSON.stringify fingerprint of the data and is rendered again when the data was mutated
in between; data that cannot be serialized is never memoized.
Parameters
component
the email component
data
object
the data
locale?
string
the locale
Returns
Promise<RenderedEmail>
the rendered email