@@ -56,14 +56,17 @@ export const convert = async (convertionOptions: ConvertionOptions): Promise<voi
56
56
for ( let i = 0 ; i < files . length ; i ++ ) {
57
57
if ( files [ i ] . isFile ( ) ) {
58
58
const fileNameWithEnding = files [ i ] . name ;
59
- const filenameWithoutEnding = fileNameWithEnding . split ( '.' ) [ 0 ] ;
60
- const directoryPath = filesDirectoryPath [ fileNameWithEnding ] ;
61
- const rawSvg = await extractSvgContent ( fileNameWithEnding , directoryPath ) ;
62
- const optimizedSvg = await svgo . optimize ( rawSvg ) ;
63
- const variableName = getVariableName ( convertionOptions , filenameWithoutEnding ) ;
64
- const typeName = getTypeName ( filenameWithoutEnding , convertionOptions . delimiter ) ;
65
- types += `'${ typeName } '${ typesDelimitor } ` ;
66
- svgConstants += getSvgConstant ( variableName , convertionOptions . interfaceName , typeName , optimizedSvg . data ) ;
59
+ const [ filenameWithoutEnding , extension ] = fileNameWithEnding . split ( '.' ) ;
60
+
61
+ if ( extension === 'svg' ) {
62
+ const directoryPath = filesDirectoryPath [ fileNameWithEnding ] ;
63
+ const rawSvg = await extractSvgContent ( fileNameWithEnding , directoryPath ) ;
64
+ const optimizedSvg = await svgo . optimize ( rawSvg ) ;
65
+ const variableName = getVariableName ( convertionOptions , filenameWithoutEnding ) ;
66
+ const typeName = getTypeName ( filenameWithoutEnding , convertionOptions . delimiter ) ;
67
+ types += `'${ typeName } '${ typesDelimitor } ` ;
68
+ svgConstants += getSvgConstant ( variableName , convertionOptions . interfaceName , typeName , optimizedSvg . data ) ;
69
+ }
67
70
}
68
71
}
69
72
types = types . substring ( 0 , types . length - typesDelimitor . length ) + ';' ;
0 commit comments