Learn how to render your templates.
Before rendering your email templates with JSX Mail, it’s essential to prepare your project. This preparation step ensures everything is set up correctly for rendering, including image uploads and template compilation.
For this example, we will use the JSX Mail Cloud with the CLI to host the assets and even send the email. If you don’t want to use the JSX Mail Cloud, you can run the project locally or even zip your template
To log into your JSX Mail Cloud Account just type:
When using JSX Mail in production, whether in your CI/CD pipeline or on a cloud platform, you also can log into a JSX Mail Cloud account. However, the login process differs slightly from when you’re on your local machine. Please refer to this guide for instructions on how to proceed.
The jsxm prepare
command is a crucial step in this process. To execute it, first, stop the preview server and run the following command in your terminal:
This command triggers JSX Mail to handle various tasks such as:
Here are some guidelines about when to use the jsxm prepare
command:
jsxm prepare
command whenever there are changes in your project, like adding new images, templates, or components.Here’s an example of how to include it in your package.json
file:
Learn more about the jsxm prepare
command here.
Rendering templates in JSX Mail can be accomplished through two primary methods: using the Command Line Interface (CLI) or employing the render
function provided by the jsx-mail
package. Both options are designed to be straightforward and efficient.
First let’s render a template using the CLI:
--out
option.--{prop-name}={prop-value}
.This method is quick and suitable for simple rendering tasks or testing.
And for more integrated scenarios, use the render
function in your code:
Learn how to render your templates.
Before rendering your email templates with JSX Mail, it’s essential to prepare your project. This preparation step ensures everything is set up correctly for rendering, including image uploads and template compilation.
For this example, we will use the JSX Mail Cloud with the CLI to host the assets and even send the email. If you don’t want to use the JSX Mail Cloud, you can run the project locally or even zip your template
To log into your JSX Mail Cloud Account just type:
When using JSX Mail in production, whether in your CI/CD pipeline or on a cloud platform, you also can log into a JSX Mail Cloud account. However, the login process differs slightly from when you’re on your local machine. Please refer to this guide for instructions on how to proceed.
The jsxm prepare
command is a crucial step in this process. To execute it, first, stop the preview server and run the following command in your terminal:
This command triggers JSX Mail to handle various tasks such as:
Here are some guidelines about when to use the jsxm prepare
command:
jsxm prepare
command whenever there are changes in your project, like adding new images, templates, or components.Here’s an example of how to include it in your package.json
file:
Learn more about the jsxm prepare
command here.
Rendering templates in JSX Mail can be accomplished through two primary methods: using the Command Line Interface (CLI) or employing the render
function provided by the jsx-mail
package. Both options are designed to be straightforward and efficient.
First let’s render a template using the CLI:
--out
option.--{prop-name}={prop-value}
.This method is quick and suitable for simple rendering tasks or testing.
And for more integrated scenarios, use the render
function in your code: