-
Notifications
You must be signed in to change notification settings - Fork 2
/
fela.config.js
46 lines (40 loc) · 1.01 KB
/
fela.config.js
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
import { createRenderer } from "fela";
import { themes } from "./theme";
export function getRenderer() {
const renderer = createRenderer();
const theme = themes["light"];
const cssVariables = {};
Object.keys(theme).forEach(key => {
cssVariables["--" + key] = theme[key];
});
renderer.renderStatic(cssVariables, ":root");
renderer.renderStatic(`
@media print {
:root {
${Object.keys(theme)
.map(key => "--" + key + ":" + theme[key] + "!important;")
.join("")}
}
}
`);
renderer.renderStatic(
{
background: "var(--color-bg)",
color: "var(--color-fg)",
fontSize: "16px",
transition: "all 0.2s ease-in",
lineHeight: 1,
fontFamily:
'system-ui, -apple-system, BlinkMacSystemFont, "avenir next", avenir, "helvetica neue", helvetica, ubuntu, roboto, noto, "segoe ui", arial, sans-serif'
},
"body"
);
renderer.renderStatic(
{
margin: "0",
padding: "0"
},
"*"
);
return renderer;
}