diff --git a/plugins/cleanupNumericValues.js b/plugins/cleanupNumericValues.js index 357e887ea..5bb4a6d26 100644 --- a/plugins/cleanupNumericValues.js +++ b/plugins/cleanupNumericValues.js @@ -37,9 +37,10 @@ export const fn = (_root, params) => { element: { enter: (node) => { if (node.attributes.viewBox != null) { - const nums = node.attributes.viewBox.split(/\s,?\s*|,\s*/g); + const nums = node.attributes.viewBox.split( + /\b(?:\s+,?|\s*,)\s*(?=\S)/g, + ); node.attributes.viewBox = nums - .filter((value) => value.length != 0) .map((value) => { const num = Number(value); return Number.isNaN(num)