diff --git a/packages/utils/src/loader/custom.ts b/packages/utils/src/loader/custom.ts index a7eb746..29c0793 100644 --- a/packages/utils/src/loader/custom.ts +++ b/packages/utils/src/loader/custom.ts @@ -5,7 +5,6 @@ import type { InlineCollection, } from './types'; import { mergeIconProps } from './utils'; -import { trimSVG } from '../svg/trim'; const debug = createDebugger('@iconify-loader:custom'); diff --git a/packages/utils/src/loader/utils.ts b/packages/utils/src/loader/utils.ts index d4706fa..bf77b54 100644 --- a/packages/utils/src/loader/utils.ts +++ b/packages/utils/src/loader/utils.ts @@ -109,5 +109,7 @@ export async function mergeIconProps( } } - return customSvg && options?.customizations?.trimCustomSvg === true ? trimSVG(svg) : svg; + return customSvg && options?.customizations?.trimCustomSvg === true + ? trimSVG(svg) + : svg; } diff --git a/packages/utils/tests/get-custom-icon-test.ts b/packages/utils/tests/get-custom-icon-test.ts index c69246b..3b42bc0 100644 --- a/packages/utils/tests/get-custom-icon-test.ts +++ b/packages/utils/tests/get-custom-icon-test.ts @@ -22,6 +22,19 @@ describe('Testing getCustomIcon', () => { ); }); + test('CustomIconLoader should apply trim', async () => { + const svg = ` + + +`; + const result = await getCustomIcon(() => svg, 'a', 'b', { + customizations: { trimCustomSvg: true }, + }); + expect(result).toEqual( + '' + ); + }); + test("CustomIconLoader with transform: scale/width/height shouldn't take effect", async () => { const svg = await fs.readFile(fixturesDir + '/circle.svg', 'utf8'); const options: IconifyLoaderOptions = {