natemoo-re / astro-icon

Inline and sprite-based SVGs in Astro made easy!
https://astroicon.dev
Other
1.01k stars 57 forks source link

Offline mode #54

Closed NobbZ closed 6 months ago

NobbZ commented 1 year ago

I am using a build system for reproducible builds. This does not allow for internet access under normal circumstances.

I can circumvent this restriction by offloading the internet access to other buildsteps, though these are required to have a fixed output then.

Therefore I'd like to maintain a list of SVGs to be used in an extra file and using that to "prefetch" them into a cache location and then just tell astr-icon which cache folder to use, such that I can still use name="mdi:account" or pack="mdi" name="account" syntaxes.

Adding just names like that to a list is much easier and less error prone to me, than having to manually copy the SVGs to /src/icons, also the necessary rename on filesystem and in code takes removes the relationship to the website that mdi:account gives me.

stramel commented 1 year ago

Thanks for the suggestion! I think this is a nice to have feature that shouldn't require too much effort. I will go ahead and add this to the list of features I would like to tackle.

In the meantime, you can checkout my comment here that allows you to use the local @iconify/json module to retrieve the icons instead of the internet.

fahminlb33 commented 1 year ago

I am second to this feature. Recently I have been getting errors like UND_ERR_CONNECT_TIMEOUT when fetching the icons. I guess this is because I'm using a VPN and the firewall is kicking in from Vercel because I use a lot of icons in a single page. An offline cache might solve this problem.

GrantBirki commented 1 year ago

I also think this would be an amazing feature and it looks like it will be supported in v1 of astro-icon. I do a lot of development on plains, trains, and automobiles where internet isn't always a thing

stramel commented 1 year ago

The v1 of astro-icon will utilize the locally installed files and no longer reach out to a service.