77 resolveAndCheckInputFilePath ,
88 forEachIconTypeEdgeIncludes ,
99 isValidHexColorString ,
10+ arrayInsertAt ,
1011} from './helpers'
1112import { IconType } from './types'
1213
@@ -23,11 +24,17 @@ export async function faviconize(
2324) {
2425 const resolvedImageInput = Buffer . isBuffer ( imageInput ) ? imageInput : await resolveAndCheckInputFilePath ( imageInput )
2526 const normalizedOutputTypes = normalizeOutputTypes ( outputIconTypes )
26- const resolvedOutputPath = await resolveAndCreateOrUseOutputPath ( outputDirectoryPath )
27+ const resolvedOutputDirectoryPath = await resolveAndCreateOrUseOutputPath ( outputDirectoryPath )
2728
2829 await forEachIconTypeEdgeIncludes ( normalizedOutputTypes , async ( type , edge ) => {
2930 const size = [ edge , edge ]
30- const outputFileAbsolutePath = path . join ( resolvedOutputPath , `${ type } -${ size . join ( 'x' ) } .png` )
31+
32+ const outputFileName =
33+ type === 'msapplication-square[size]logo'
34+ ? `${ arrayInsertAt ( type . split ( '[size]' ) , 1 , size . join ( 'x' ) ) . join ( "" ) } .png`
35+ : `${ type } -${ size . join ( 'x' ) } .png`
36+
37+ const outputFileAbsolutePath = path . join ( resolvedOutputDirectoryPath , outputFileName )
3138
3239 await sharp ( resolvedImageInput )
3340 . resize ( ...size )
@@ -54,11 +61,16 @@ export async function generateIconsLinkTags(outputIconTypes?: IconType | Array<I
5461
5562 await forEachIconTypeEdgeIncludes ( normalizedOutputTypes , ( type , edge ) => {
5663 const size = [ edge , edge ]
57- const fileName = `${ type } -${ size . join ( 'x' ) } .png`
64+
65+ const fileName =
66+ type === 'msapplication-square[size]logo'
67+ ? `${ arrayInsertAt ( type . split ( '[size]' ) , 1 , size . join ( 'x' ) ) . join ( "" ) } .png`
68+ : `${ type } -${ size . join ( 'x' ) } .png`
69+
5870 const filePath = path . join ( 'icons' , fileName )
5971
60- if ( type === 'msapplication-TileImage ' ) {
61- linkTags . push ( `<meta name="msapplication-TileImage " content="${ filePath } ">` )
72+ if ( type === 'msapplication-square[size]logo ' ) {
73+ linkTags . push ( `<meta name="msapplication-square ${ size . join ( 'x' ) } logo " content="${ filePath } ">` )
6274 return
6375 }
6476
0 commit comments