-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathgenerate-icon-overview.ts
62 lines (58 loc) · 1.43 KB
/
generate-icon-overview.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
/*
* This script can be used to update the icon overview for foundation testing.
*/
import { writeFileSync } from 'node:fs';
import * as prettier from 'prettier';
import { ALL_ICONS } from '../../src';
const generateIconOverview = async () => {
try {
const generatedDisclaimer = 'This file was generated';
const iconHtml = `<!--${generatedDisclaimer}-->
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Icon Overview</title>
<link rel="stylesheet" href="/dev/index.css" />
<link rel="stylesheet" href="/build/styles/icons/absolute.css" />
<style>
.db-infotext {
display: none !important;
}
</style>
</head>
<body>
<div class="icons-overview-container">
${
/* eslint-disable-next-line @typescript-eslint/no-unsafe-call */
ALL_ICONS.map(
(icon) => `
<div data-spacing="small" class="db-card">
<span
aria-hidden="true"
class="db-icon"
data-icon="${icon}"
>${icon}</span
><span
class="db-infotext"
data-icon="none"
data-semantic="informational"
>${icon}</span
>
</div>`
).join('\n')
}
</div>
</body>
</html>`;
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call
const output: string = await prettier.format(iconHtml, {
parser: 'html'
});
writeFileSync('./dev/icons.html', output);
} catch (error) {
console.error(error);
}
};
void generateIconOverview();