diff --git a/.changeset/green-camels-teach.md b/.changeset/green-camels-teach.md new file mode 100644 index 00000000..6405db4a --- /dev/null +++ b/.changeset/green-camels-teach.md @@ -0,0 +1,5 @@ +--- +"astro-icon": minor +--- + +Pass props to custom resolvers diff --git a/demo/src/icons/custom.ts b/demo/src/icons/custom.ts new file mode 100644 index 00000000..6732a2ef --- /dev/null +++ b/demo/src/icons/custom.ts @@ -0,0 +1,6 @@ +export default async (name: string, { size }): Promise => { + return ` + + + `; +}; diff --git a/demo/src/pages/index.astro b/demo/src/pages/index.astro index b78a0a22..f624a2fd 100644 --- a/demo/src/pages/index.astro +++ b/demo/src/pages/index.astro @@ -28,7 +28,7 @@ import { Icon } from 'astro-icon';

The Icon component will optimize and inline any SVG file inside of src/icons/

Alternatively, see the Sprite method.

- +

Local

@@ -39,9 +39,15 @@ import { Icon } from 'astro-icon';

Custom remote source

- + +
+ +
+

Custom SVG resolver

+ +
- +

Local dependencies

diff --git a/packages/core/lib/utils.ts b/packages/core/lib/utils.ts index 0a4280da..daa2485d 100644 --- a/packages/core/lib/utils.ts +++ b/packages/core/lib/utils.ts @@ -170,7 +170,7 @@ export default async function load( if (typeof get === "undefined") { get = getFromService.bind(null, pack); } - const contents = await get(name); + const contents = await get(name, inputProps); if (!contents) { throw new Error( ` did not return an icon!`