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

Example with Custom Icons Working with ssr:false #323

Open
JohnCampionJr opened this issue Dec 14, 2024 · 5 comments
Open

Example with Custom Icons Working with ssr:false #323

JohnCampionJr opened this issue Dec 14, 2024 · 5 comments

Comments

@JohnCampionJr
Copy link

I'm trying to use custom iconify collections, as mentioned in #311 and I can get it to work under normal conditions.

But when generating with ssr:false the icons don't appear.

I was hoping someone might have an example of how to get this working?

Similar to #311, I can't do the svg custom collection provided as there are an enormous number of svg files.

@antfu
Copy link
Member

antfu commented Dec 16, 2024

That's the tricky part I mentioned in #311. If you don't use ssr but have an API server, you can set provider: 'server' so the icons would be requested from the server. Otherwise, there is honestly no way to serve custom icons (because Iconify doesn't have your custom icons) other than bundle them all into the client.

@JohnCampionJr
Copy link
Author

I understand the server part; I'm just trying to get the client bundle working with the custom icons and I seem to have no luck.

@antfu
Copy link
Member

antfu commented Dec 16, 2024

The approach of #311 won't to not to treat custom icons specially from Iconify icons, meaning that if you want to get them into the client bundle, you either need to scan the static usages or manually include icons you wanted

@JohnCampionJr
Copy link
Author

JohnCampionJr commented Dec 16, 2024

I tried the scan: true in the clientBundle options. Is it possible its ignoring the new additionalCollections option?

I'll try to put together a repo to see if there is a bug here or something.

@JohnCampionJr
Copy link
Author

https://github.com/JohnCampionJr/nuxt-icon-custom

In case it will help anyone else, I've put together a sample that seems to work as expected.

Can you check real quick and see if there is any optimizations to make?

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

No branches or pull requests

2 participants