diff --git a/packages/utils/package.json b/packages/utils/package.json index c38aff5..6a48939 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -3,7 +3,7 @@ "type": "module", "description": "Common functions for working with Iconify icon sets used by various packages.", "author": "Vjacheslav Trushkin", - "version": "2.1.28", + "version": "2.1.29", "license": "MIT", "bugs": "https://github.com/iconify/iconify/issues", "homepage": "https://iconify.design/docs/libraries/utils/", diff --git a/packages/utils/src/loader/utils.ts b/packages/utils/src/loader/utils.ts index 1f77092..eac6901 100644 --- a/packages/utils/src/loader/utils.ts +++ b/packages/utils/src/loader/utils.ts @@ -1,5 +1,6 @@ import type { Awaitable } from '@antfu/utils'; import { isUnsetKeyword } from '../svg/build'; +import { calculateSize } from '../svg/size'; import type { IconifyLoaderOptions } from './types'; const svgWidthRegex = /\swidth\s*=\s*["']([\w.]+)["']/; @@ -23,7 +24,11 @@ function configureSvgSize( if (typeof scale === 'number') { // Scale icon, unless scale is 0 if (scale > 0) { - props[prop] = `${scale}em`; + props[prop] = calculateSize( + // Base on result from iconToSVG() or 1em + result?.[1] ?? '1em', + scale + ); } } else if (result) { // Use result from iconToSVG()