@@ -54,15 +54,18 @@ async function generateComponentsForAllFamilies(icon) {
54
54
const families = getIncludedFamilies ( icon . unsupported_families )
55
55
56
56
for ( let i = 0 ; i < families . length ; i ++ ) {
57
- await generateComponent ( icon , families [ i ] )
57
+ await Promise . all ( [
58
+ generateComponent ( icon , families [ i ] ) ,
59
+ generateComponent ( icon , families [ i ] , true ) ,
60
+ ] )
58
61
}
59
62
}
60
63
61
- async function generateComponent ( icon , family ) {
64
+ async function generateComponent ( icon , family , filled = false ) {
62
65
try {
63
- const name = formatName ( icon . name , family . postfix )
66
+ const name = formatName ( icon . name , family . postfix , filled )
64
67
65
- const svg = await downloadSVG ( icon . name , family . id )
68
+ const svg = await downloadSVG ( icon . name , family . id , filled )
66
69
67
70
console . log ( `Downloading ${ name } ` )
68
71
@@ -76,21 +79,22 @@ async function generateComponent(icon, family) {
76
79
}
77
80
}
78
81
79
- function formatName ( string , familyPostfix ) {
82
+ function formatName ( string , familyPostfix , filled ) {
80
83
const formattedString = string
81
84
. replace ( / _ / g, ' ' )
82
85
. replace ( / \w \S * / g, ( txt ) => {
83
86
return txt . charAt ( 0 ) . toUpperCase ( ) + txt . substr ( 1 ) . toLowerCase ( )
84
87
} )
85
88
. replace ( / / g, '' )
86
89
87
- return 'Icon' + formattedString + familyPostfix
90
+ return 'Icon' + formattedString + familyPostfix + ( filled ? 'Filled' : '' )
88
91
}
89
92
90
- async function downloadSVG ( icon , familyId ) {
93
+ async function downloadSVG ( icon , familyId , filled ) {
94
+ const filledConfig = filled ? 'fill1' : 'default'
91
95
const svg = await axios
92
96
. get (
93
- `https://fonts.gstatic.com/s/i/short-term/release/${ familyId } /${ icon } /default /24px.svg` ,
97
+ `https://fonts.gstatic.com/s/i/short-term/release/${ familyId } /${ icon } /${ filledConfig } /24px.svg` ,
94
98
)
95
99
. catch ( ( err ) => console . log ( err ) )
96
100
0 commit comments