Skip to content

Commit

Permalink
fix(svgo): correctly pick up options from external config file
Browse files Browse the repository at this point in the history
  • Loading branch information
nivekcode committed Jun 4, 2020
1 parent 4a2cf39 commit 9b8d138
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 8 deletions.
2 changes: 0 additions & 2 deletions src/lib/converters/multiple-files.converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ const writeFiles = async (outputDirectory, iconsFolderName, modelFileName, prefi

export const convertToMultipleFiles = async (convertionOptions: MultiFileConvertionOptions): Promise<void> => {
const {
typeName,
interfaceName,
prefix,
outputDirectory,
modelFileName,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/helpers/file-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const writeFile = async (outputDirectory: string, fileName: string, fileC
await writeFileToFS(path.join(outputDirectory, `${fileName}.ts`), formatedFileContent);
};

export const readFile = async (filePath: string): Promise<any> => {
export const readFile = async (filePath: string): Promise<string> => {
return readfileFromFS(filePath, 'utf-8');
};

Expand Down
2 changes: 1 addition & 1 deletion src/lib/helpers/svg-optimization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const generateSvgOptimizer = config => new svgo(config);

export const getSvgoConfig = async (svgoConfig: any): Promise<string> => {
if (typeof svgoConfig === 'string') {
return readFile(svgoConfig);
return JSON.parse(await readFile(svgoConfig));
}
return svgoConfig;
};
5 changes: 1 addition & 4 deletions svgo-test.config.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
{
"plugins": [
{
"cleanupAttrs": true
},
{
"removeDoctype": true
"removeViewBox": false
}
]
}

0 comments on commit 9b8d138

Please sign in to comment.