Skip to content

Commit 230f474

Browse files
feat(docs): Preview server deployment page (#1658)
Co-authored-by: Zeno Rocha <[email protected]>
1 parent 5fe49a3 commit 230f474

File tree

4 files changed

+66
-11
lines changed

4 files changed

+66
-11
lines changed

apps/docs/cli.mdx

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ your email template when you make changes.
7171
You can refer to our [demo emails source code](https://demo.react.email/preview/vercel-invite-user.tsx?view=source)
7272
for an example of how we do this with our demo deploy on Vercel.
7373
</Info>
74+
7475
</Accordion>
7576
<Accordion title="How can I define props specific to the email's preview?">
7677
Considering that you are already default exporting the React component
@@ -98,6 +99,7 @@ your email template when you make changes.
9899

99100
<Email {...Email.PreviewProps} />;
100101
```
102+
101103
</Accordion>
102104
<Accordion title="How to make the preview server ignore directories?">
103105
Once the preview server has started and is now open on `localhost`, the preview server
@@ -118,6 +120,7 @@ your email template when you make changes.
118120
```
119121

120122
Then the only file that will be shown on the preview server is going to be your `email.tsx`.
123+
121124
</Accordion>
122125
<Accordion title="The heuristics for files to be considered emails">
123126
To avoid uncanny files appearing in the sidebar of the preview server,
@@ -130,6 +133,7 @@ your email template when you make changes.
130133

131134
These can certainly fail as they are only heuristics, so if you do find
132135
any issues with these, feel free to open an [issue](https://github.com/resend/react-email/issues).
136+
133137
</Accordion>
134138
</AccordionGroup>
135139

@@ -156,16 +160,18 @@ Generates the plain HTML files of your emails into a `out` directory.
156160
A very common misconception is to assume that this command is
157161
the way meant to be used to send the email templates, but it is not.
158162

159-
The preferable way is to render the email using the [render](/utilities/render) utility,
160-
by passing in the needed data through props, on the moment of sending the email,
161-
This gives for a much better developer experience that it would with `email export`.
163+
The preferable way is to render the email using the [render](/utilities/render) utility,
164+
by passing in the needed data through props, on the moment of sending the email,
165+
This gives for a much better developer experience that it would with `email export`.
166+
167+
`email export` is a secondary way where the situation is not optimal. Two of them are:
168+
169+
- The email template is sent through some other language
170+
- You are going to use separate templating, because the email platform you use forces you to do so
162171

163-
`email export` is a secondary way where the situation is not optimal. Two of them are:
164-
- The email template is sent through some other language
165-
- You are going to use separate templating, because the email platform you use forces you to do so
172+
We strongly recommend users to gravitate towards using the preferable way, because otherwise
173+
you will end up having to fight a lot with the rendered markup and many other issues arise.
166174

167-
We strongly recommend users to gravitate towards using the preferable way, because otherwise
168-
you will end up having to fight a lot with the rendered markup and many other issues arise.
169175
</Info>
170176

171177
**Options**
@@ -185,4 +191,4 @@ Generates the plain HTML files of your emails into a `out` directory.
185191

186192
## `email help <cmd>`
187193

188-
Shows all the options for a specific command.
194+
Shows all the options for a specific command.

apps/docs/deployment.mdx

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
title: "Deployment"
3+
sidebarTitle: "Deployment"
4+
description: "How to deploy the `email dev` preview server to Vercel"
5+
"og:image": "https://react.email/static/covers/react-email.png"
6+
icon: "rocket"
7+
---
8+
9+
<Steps>
10+
<Step title="Add 'build' script to ./package.json">
11+
```diff
12+
{
13+
"scripts": {
14+
+ "build": "email build"
15+
}
16+
}
17+
```
18+
</Step>
19+
<Step title="Change 'Framework Preset' on Vercel's project settings to Next.js">
20+
You also need to add "next" on `devDependencies` to work properly:
21+
22+
```diff
23+
{
24+
"devDependencies": {
25+
+ "next": "*",
26+
}
27+
}
28+
```
29+
30+
This is a limitation on Vercel's Next Framework Preset.
31+
</Step>
32+
<Step title="Change 'Output Directory' to .react-email/.next">
33+
In the end, your settings should look like this:
34+
35+
<Frame>
36+
<img alt="Proper Vercel settings" src="/images/preview-server-vercel-settings.png" />
37+
</Frame>
38+
</Step>
39+
</Steps>
521 KB
Loading

apps/docs/mint.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"$schema": "https://mintlify.com/schema.json",
23
"name": "React Email",
34
"logo": {
45
"light": "/logo/light.svg",
@@ -43,7 +44,14 @@
4344
"navigation": [
4445
{
4546
"group": "Overview",
46-
"pages": ["introduction", "contributing", "changelog", "roadmap", "cli"]
47+
"pages": [
48+
"introduction",
49+
"contributing",
50+
"changelog",
51+
"roadmap",
52+
"cli",
53+
"deployment"
54+
]
4755
},
4856
{
4957
"group": "Getting Started",
@@ -88,7 +96,9 @@
8896
},
8997
{
9098
"group": "Utilities",
91-
"pages": ["utilities/render"]
99+
"pages": [
100+
"utilities/render"
101+
]
92102
},
93103
{
94104
"group": "Integrations",

0 commit comments

Comments
 (0)