-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdynamic-assets-mapping.js
More file actions
95 lines (88 loc) · 3.4 KB
/
Copy pathdynamic-assets-mapping.js
File metadata and controls
95 lines (88 loc) · 3.4 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
module.exports = function (themeConfig) {
let fontBody = themeConfig.customConfig['fontBody'];
let fontHeadings = themeConfig.customConfig['fontHeadings'];
let fontBodyItalic = themeConfig.customConfig['fontBodyItalic'];
let fontHeadingsItalic = themeConfig.customConfig['fontHeadingsItalic'];
let assets = new Set();
const fontParams = {
'adventpro': { hasItalic: true },
'aleo': { hasItalic: true },
'andadapro': { hasItalic: true },
'antonio': { hasItalic: false },
'archivonarrow': { hasItalic: true },
'asap': { hasItalic: true },
'assistant': { hasItalic: false },
'besley': { hasItalic: true },
'bitter': { hasItalic: true },
'brygada1918': { hasItalic: true },
'cabin': { hasItalic: true },
'cairo': { hasItalic: false },
'comfortaa': { hasItalic: false },
'dancingscript': { hasItalic: false },
'dosis': { hasItalic: false },
'domine': { hasItalic: false },
'exo': { hasItalic: true },
'faustina': { hasItalic: true },
'figtree': { hasItalic: true },
'frankruhllibre': { hasItalic: false },
'glory': { hasItalic: true },
'gluten': { hasItalic: false },
'heebo': { hasItalic: false },
'imbue': { hasItalic: false },
'instrumentsans': { hasItalic: true },
'inter': { hasItalic: true },
'jetbrainsmono': { hasItalic: true },
'jura': { hasItalic: false },
'karla': { hasItalic: true },
'kreon': { hasItalic: false },
'labrada': { hasItalic: true },
'lemonada': { hasItalic: false },
'lexend': { hasItalic: false },
'librefranklin': { hasItalic: true },
'lora': { hasItalic: true },
'manuale': { hasItalic: true },
'manrope': { hasItalic: false },
'mavenpro': { hasItalic: false },
'merriweathersans': { hasItalic: true },
'montserrat': { hasItalic: true },
'nunito': { hasItalic: true },
'orbitron': { hasItalic: false },
'oswald': { hasItalic: false },
'petrona': { hasItalic: true },
'playfairdisplay': { hasItalic: true },
'plusjakartasans': { hasItalic: true },
'publicsans': { hasItalic: true },
'quicksand': { hasItalic: false },
'raleway': { hasItalic: true },
'redhatdisplay': { hasItalic: true },
'redhatmono': { hasItalic: true },
'robotoflex': { hasItalic: false },
'robotoslab': { hasItalic: false },
'rokkitt': { hasItalic: true },
'rubik': { hasItalic: true },
'ruda': { hasItalic: false },
'smoochsans': { hasItalic: false },
'sourcecodepro': { hasItalic: true },
'spartan': { hasItalic: false },
'system-ui': { hasItalic: false },
'urbanist': { hasItalic: true },
'worksans': { hasItalic: true },
'yanonekaffeesatz': { hasItalic: false },
'yrsa': { hasItalic: true }
};
const addFontAsset = (font, hasItalic) => {
assets.add('/fonts/' + font + '/' + font + '.woff2');
if (hasItalic && fontParams[font]?.hasItalic) {
assets.add('/fonts/' + font + '/' + font + '-italic.woff2');
}
};
if (fontBody !== 'system-ui') {
addFontAsset(fontBody, fontBodyItalic);
}
if (fontHeadings !== 'system-ui' && fontHeadings !== fontBody) {
addFontAsset(fontHeadings, fontHeadingsItalic);
} else if (fontHeadingsItalic && !fontBodyItalic && fontParams[fontHeadings]?.hasItalic) {
addFontAsset(fontHeadings, fontHeadingsItalic);
}
return Array.from(assets);
};