Quick Start
Get started quickly with JSX email
Prerequisites
- Node.js LTS version (v18.0.0+)
- React v18.2.0+
New to Node.js?
Before starting, familiarize yourself with:
New Project Setup
The fastest way to start is using our project creation tool:
npm create jsx-email
This creates an email-project
directory with a starter template.
Installation
Install JSX email in your project:
pnpm add jsx-email
npm install jsx-email
yarn add jsx-email
bun add jsx-email
One-Time Execution
Run commands without installation:
pnpm dlx email <command>
npx email <command>
yarn dlx email <command>
bunx email <command>
Creating Templates
These steps will create a new template named BatmanEmail.tsx
in the ./emails
directory.
-
Create templates directory:
Terminal window mkdir ./emails -
Generate template:
Terminal window email create BatmanEmail --out=./emails
Development
Preview Server
JSX-email includes a lightweight preview server with:
- No additional dependencies
- Simple setup
- Monorepo support
- Hot reloading
Launch the preview server:
email preview ./emails
Windows Users
Windows paths differ from Unix-like systems. Please see the link above regarding Windows relative paths if you are unfamiliar with how they work on the Command Line.
The CLI will startup a preview server and open a new browser tab at http://localhost:55420
. It’s that simple.
Preview server options:
email help preview
Building Templates
Build templates using either:
- CLI for static output
render
method for dynamic runtime rendering
CLI Build
email build ./emails/BatmanEmail.tsx