-
Notifications
You must be signed in to change notification settings - Fork 23
/
server.ts
76 lines (72 loc) · 1.83 KB
/
server.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import './windowMock';
import mjml2html from 'mjml';
import { JsonToMjml } from 'easy-email-core'
const content = {
"type": "page",
"data": {
"value": {
"breakpoint": "480px",
"headAttributes": "",
"font-size": "14px",
"font-weight": "400",
"line-height": "1.7",
"headStyles": [],
"fonts": [],
"responsive": true,
"font-family": "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans','Helvetica Neue', sans-serif",
"text-color": "#000000"
}
},
"attributes": {
"background-color": "#efeeea",
"width": "600px"
},
"children": [
{
"type": "wrapper",
"data": {
"value": {}
},
"attributes": {
"padding": "20px 0px 20px 0px",
"border": "none",
"direction": "ltr",
"text-align": "center"
},
"children": [
{
"type": "advanced_button",
"data": {
"value": {
"content": "Button"
}
},
"attributes": {
"align": "center",
"background-color": "#414141",
"color": "#ffffff",
"font-weight": "normal",
"border-radius": "3px",
"padding": "10px 25px 10px 25px",
"inner-padding": "10px 25px 10px 25px",
"line-height": "120%",
"target": "_blank",
"vertical-align": "middle",
"border": "none",
"text-align": "center",
"href": "#"
},
"children": []
}
]
}
]
};
const parseHtml = mjml2html(
JsonToMjml({
data: content,
mode: 'production',
context: content,
})
).html;
console.log(parseHtml);