Skip to content

Commit 2b2353b

Browse files
committed
feat(core): pass info to SVGO
Closes #152 Will enhance support of SVGO plugins like prefixIds (https://github.com/svg/svgo/blob/master/plugins/prefixIds.js).
1 parent 4110f67 commit 2b2353b

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

packages/core/src/plugins/svgo.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ export default async (code, config = {}, state = {}) => {
2828
const svgo = new SVGO(
2929
mergeConfigs(getBaseSvgoConfig(config), svgoRcConfig, config.svgoConfig),
3030
)
31-
const { data } = await svgo.optimize(code)
31+
const info = state.filePath
32+
? { input: 'file', path: state.filePath }
33+
: { input: 'string' }
34+
const { data } = await svgo.optimize(code, info)
3235
return data
3336
}

0 commit comments

Comments
 (0)