-
Notifications
You must be signed in to change notification settings - Fork 0
/
createHtml.js
61 lines (54 loc) · 1.09 KB
/
createHtml.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
function createHTML(f, file) {
const icons = f.svg.defs[0].font[0].glyph;
const font = f.svg.defs[0].font[0].$.id;
let html = `<html>
<style>
@font-face {
font-family: ${font};
src: url("${file}.ttf");
-fs-pdf-font-embed: embed;
-fs-pdf-font-encoding: Identity-H;
}
h2 {
font-weight: normal;
font-family: sans-serif;
color: #1c7d06;
font-size: 1rem;
}
.is {
display: flex;
flex-wrap: wrap;
justify-content: center;
width: 100%;
align-items: center;
}
.container {
width: 120px;
margin: 2rem;
}
i {
font-family: '${font}' !important;
font-style: normal;
}
i:before {
font-size:2rem;
}
`;
icons.forEach(m => {
html += `
.icon-${m.$['glyph-name']}:before {
content: "${m.$.unicode}";
}`
});
html += `</style><body><h1>${font}</h1><div class='is'>`
icons.forEach(m => {
html += `
<div class="container">
<h2>icon-${m.$['glyph-name']}<br/>${m.$.unicode}</h2>
<i class="icon-${m.$['glyph-name']}"></i>
</div>`
});
html+= `</div></body></html>`;
return html;
}
module.exports = createHTML;