react-email 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.js +6 -1
- package/package.json +3 -3
- package/readme.md +1 -45
package/build/index.js
CHANGED
|
@@ -28,7 +28,12 @@ const ReactDomServer = __importStar(require("react-dom/server"));
|
|
|
28
28
|
const render = (component) => {
|
|
29
29
|
const docType = '<!DOCTYPE htmlPUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
|
|
30
30
|
const markup = ReactDomServer.renderToStaticMarkup(component);
|
|
31
|
-
const html = `${docType}<html xmlns="http://www.w3.org/1999/xhtml"
|
|
31
|
+
const html = `${docType}<html xmlns="http://www.w3.org/1999/xhtml">
|
|
32
|
+
<head>
|
|
33
|
+
<meta http-equiv="Content-Type" content="text/html charset=UTF-8" />
|
|
34
|
+
</head>
|
|
35
|
+
<body>${markup}</body>
|
|
36
|
+
</html>`;
|
|
32
37
|
return html;
|
|
33
38
|
};
|
|
34
39
|
exports.render = render;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-email",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"typings": "build/index.d.ts",
|
|
@@ -32,13 +32,13 @@
|
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@babel/preset-react": "7.18.6",
|
|
35
|
-
"@types/jest": "28.1.
|
|
35
|
+
"@types/jest": "28.1.7",
|
|
36
36
|
"@types/node": "18.6.4",
|
|
37
37
|
"@types/react-dom": "18.0.6",
|
|
38
38
|
"babel-jest": "28.1.3",
|
|
39
39
|
"jest": "28.1.3",
|
|
40
40
|
"prettier": "2.7.1",
|
|
41
|
-
"ts-jest": "28.0.
|
|
41
|
+
"ts-jest": "28.0.8",
|
|
42
42
|
"tslint": "6.1.3",
|
|
43
43
|
"typescript": "4.7.4"
|
|
44
44
|
}
|
package/readme.md
CHANGED
|
@@ -1,45 +1 @@
|
|
|
1
|
-
# react-email
|
|
2
|
-
|
|
3
|
-
Convert React components into HTML email templates.
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install react-email
|
|
9
|
-
# or
|
|
10
|
-
yarn add react-email
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Usage
|
|
14
|
-
|
|
15
|
-
Start by creating your email template as a React component.
|
|
16
|
-
|
|
17
|
-
```jsx
|
|
18
|
-
import React from 'react'
|
|
19
|
-
|
|
20
|
-
export default function EmailTemplate(props) {
|
|
21
|
-
const { firstName } = props
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<>
|
|
25
|
-
<h1>Welcome, {firstName}!</h1>
|
|
26
|
-
<p>Thanks for trying our product. We’re thrilled to have you on board.</p>
|
|
27
|
-
</>
|
|
28
|
-
)
|
|
29
|
-
}
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
Then import the template component and render it.
|
|
33
|
-
|
|
34
|
-
```js
|
|
35
|
-
import reactEmail from 'react-email'
|
|
36
|
-
import MyTemplate from '../components/MyTemplate'
|
|
37
|
-
|
|
38
|
-
const html = reactEmail.render(
|
|
39
|
-
<MyTemplate firstName="Jim" />
|
|
40
|
-
)
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## License
|
|
44
|
-
|
|
45
|
-
MIT License
|
|
1
|
+
# Moved to [@react-email/render](https://www.npmjs.com/package/@react-email/render)
|