Skip to content

Commit

Permalink
feat(svgo): automatically prefix svg ids with filename
Browse files Browse the repository at this point in the history
  • Loading branch information
nivekcode committed Jun 4, 2020
1 parent 9b8d138 commit 5bb989b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/converters/shared.converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const filesProcessor = async (convertionOptions): Promise<SvgDefinition[]
if (extension === 'svg') {
const rawSvg = await extractSvgContent(filePath);
info(`optimize svg: ${fileNameWithEnding}`);
const optimizedSvg = await svgOptimizer.optimize(rawSvg);
const optimizedSvg = await svgOptimizer.optimize(rawSvg, { path: filePath });
const variableName = generateVariableName(prefix, filenameWithoutEnding);

const typeName = generateTypeName(filenameWithoutEnding, delimiter);
Expand Down
3 changes: 3 additions & 0 deletions src/lib/options/default-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ export const DEFAULT_OPTIONS = {
},
{
removeDimensions: true
},
{
prefixIds: true
}
]
}
Expand Down

0 comments on commit 5bb989b

Please sign in to comment.