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

docs: flesh out icons section and make standalone page #13555

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

benmccann
Copy link
Member

I think this fits better as a separate page and is more discoverable. It doesn't really make sense to talk about CSS-based icons on the images page and none of these get optimized.

I had wanted to make this a separate page originally, but didn't have enough content. I added some more to it, so that it looks decent as its own page now. I tested locally to ensure it renders nicely

@benmccann benmccann added the documentation Improvements or additions to documentation label Mar 6, 2025
Copy link

changeset-bot bot commented Mar 6, 2025

⚠️ No Changeset found

Latest commit: 34c30de

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

@svelte-docs-bot
Copy link

@jhwz
Copy link

jhwz commented Mar 6, 2025

When choosing an icon library, it is recommended to avoid those that provide a .svelte file per icon as these libraries can have thousands of .svelte files which really slow down Vite's dependency optimization

Any chance you could touch on what icon libraries we should prefer then? i.e. what is the best strategy for releasing icon libraries in svelte. Just the aforementioned CSS?

@benmccann
Copy link
Member Author

Any chance you could touch on what icon libraries we should prefer then?

I really like the CSS approach. I don't necessarily want to favor one library over another, but if you want an example of one that is easier to compile you can see the approach taken by https://github.com/RobBrazier/svelte-awesome which has only a few .svelte files

@jhwz
Copy link

jhwz commented Mar 6, 2025

I really like the CSS approach

Interesting, from https://iconify.design/docs/usage/css/:

CSS usually contains all icons, including ones not used on the current page

It seems that this approach generally doesn't support tree shaking etc? So you pay for all the icons if you use just a few? Or you can do something like in RobBrazier/svelte-awesome but man from a quick look through that looks messy 😅

A shame .svelte files are discouraged/don't play nicely with vite. It's definitely the most intuitive approach.

@benmccann
Copy link
Member Author

CSS usually contains all icons, including ones not used on the current page

That's not true. I'm not sure why they've written it. I filed an issue to ask about it: iconify/iconify#367

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants