-
-
Notifications
You must be signed in to change notification settings - Fork 71
feat(core): rewrite to use built-in svg components #239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: next
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 8d750ae The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
e2ca5e5
to
05d358c
Compare
a43bfff
to
52e0323
Compare
5148423
to
eb307b8
Compare
height = DEFAULT_ICON_SIZE, | ||
body, | ||
} = data; | ||
const svg = `<svg data-icon="${collection}:${icon}" width="${width}" height="${height}" viewBox="0 0 ${width} ${height}">${body}</svg>`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@natemoo-re Should we switch this to {collection}/{icon}
? This would match the import rather than having a separate way of referencing the combination
const svg = `<svg data-icon="${collection}:${icon}" width="${width}" height="${height}" viewBox="0 0 ${width} ${height}">${body}</svg>`; | |
const svg = `<svg data-icon="${collection}/${icon}" width="${width}" height="${height}" viewBox="0 0 ${width} ${height}">${body}</svg>`; |
Warning
These changes are still highly volatile and likely to change. Proceed with caution
Building on top of the hopefully soon to be accepted Built-in SVG components in withastro/astro#12067. Discussed here withastro/roadmap#699
This adds virtual paths to the Iconify collections and icons. Simply import
astro:icons/<collection>/<icon>
in order to use the icon component.This changes also removes the functionality associated with local svg imports since this is now covered through Astro.
Another big change is that we're no longer running SVGO. I'm assuming that Iconify is handling most of the optimizations for us. Any local icon optimizations would be moved into the astro repo (likely post MVP)
TODO:
Possible Future Enhancements:
Typescript Plugin: We could write a typescript plugin that could autosuggest collections and icons as you type. We could also add additional validation for collection + icon combinations. We could also warn on deprecated usages.
Dev Toolbar: We could write a dev toolbar that could highlight all icons, show deprecated icons, and list all icons on the page. We could also potentially suggest icons that would be good candidates for sprite mode.