Skip to content
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

feat(core): rewrite to use built-in svg components #239

Open
wants to merge 20 commits into
base: next
Choose a base branch
from

Conversation

stramel
Copy link
Collaborator

@stramel stramel commented Sep 25, 2024

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:

  • rewrite functionality to use the built-in SVG components
  • fix typings for virtual module imports
  • update demo to use new imports
  • fix type assertions on the integration/vite plugin
  • add better error handling
  • add logging
  • provide offline support
  • fix import.meta.env being undefined
  • clean up
  • agree upon virtual module naming
  • documentation
  • tests

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.

@stramel stramel requested a review from natemoo-re September 25, 2024 05:23
@stramel stramel self-assigned this Sep 25, 2024
Copy link

changeset-bot bot commented Sep 25, 2024

⚠️ No Changeset found

Latest commit: 339f975

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Sep 25, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
api-astroicon ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 6, 2024 5:50am
astroicon ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 6, 2024 5:50am

@stramel stramel changed the base branch from main to next September 26, 2024 00:05
@stramel stramel marked this pull request as ready for review September 26, 2024 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant