question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature Request] Iconify Support

See original GitHub issue

Problem to solve

Currently, the icons supported require loading the full CSS for icons, although this certainly works it adds quite a bit of bloat to the loading times and on very slow mobile networks can cause serious performance impacts. Generally speaking this the way everyone has always loaded icons and I say that continue to do so. However, we also need an alternative that allows loading the SVG icons.

Proposed solution

I am proposing support for https://iconify.design/ this would allow for potentially much faster load times (only load the icons on the page) and it would allow for the use of many different font packs without loading in any extra CSS or any bloat. The JS that runs it is also very small and in my own testing results in much better icon load times.

I propose that we continue to use the icon="" prop. Maybe in the same way we currently handle Material Design icons and font awesome we could use something like icon="iconify-mdi:google" where iconify- informs the vuetify icon render to use the iconify format. and the mdi:google gets passed to the data-icon="" part of the iconify format.

Another option would be to completely replace the current icon system and completely replace it with iconify as iconify already includes the Google Material Design Icons (whats currently default) as well as font-awesome, MDI and many more. Plus it could potentially actually decrease the amount of code logic required to create the icon HTML.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:6
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
cyberaliencommented, Jul 15, 2019

Author of Iconify here. I’d love to make Iconify work with Vue and solve any issues Vue users might have.

Looks like main issue is that Iconify messes with DOM. However it doesn’t really need to. It messes with DOM only if it sees icon placeholder, such as <span class="iconify" data-icon="mdi:home" /> to change it to <svg .../>.

But there are other ways to handle icons. Iconify script has many functions that can be used to render SVG without Iconify messing with DOM. Iconify exposes Iconify variable to global namespace that has many functions. I wrote short documentation for those functions: https://iconify.design/docs/functions/

Using those functions you can retrieve full SVG code and render it instead of using placeholder. For example

let icon1 = Iconify.getSVG('mdi:home');
let icon2 = Iconify.getSVG('fa-regular:home', {'data-rotate': '90deg'});
// ... render those icons

That’s the basic version.

However in reality its a bit more complex than that because icons need to be loaded first. Usually Iconify looks for icon placeholders, then requests icon data from API (or preloads them from localStorage if they were requested on previous page load), only then replaces placeholders with SVG. So rendering is asynchronous.

Iconify exposes functions to help with that:

  • Iconify.preloadImages(['mdi:home', 'fa-regular:home']); - loads icons
  • Iconify.iconExists('mdi:home'); - checks if icon exists Also there is DOM event you can subscribe to. It is fired when new icons have been loaded: IconifyAddedIcons.

With combination of those functions and event, you can build your own code to load icons, be notified when icons have loaded and render them.

Another solution is to bundle icons with package instead of loading icons from API. I’ve built React component that works like that: https://github.com/iconify/iconify-react so something like that might be built for Vue too.

I’m open to any suggestions and ideas. My goal is to build universal framework for icons and make it available on as many platforms as possible, so designers and users would have huge choice of icons on whatever platform they choose, including Vue.

3reactions
cyberaliencommented, Nov 12, 2020

Forgot about this issue, got reminded after receiving notification about issue being closed.

A while ago I’ve created Vue components for Iconify: @iconify/vue. It is available for Vue 2 and Vue 3.

Vue 2 documentation: https://docs.iconify.design/implementations/vue2/ Vue 3 documentation: https://docs.iconify.design/implementations/vue/

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Feature Request] Support for Iconify icon framework
Could you add support for Iconify icon framework to node-red-dashboard? Currently supported Material Design, Font Awesome 4.7 and Weather icons are quite ...
Read more >
Iconify Updates
Stable versions of new icon components have been published. All components can load icons on demand from Iconify API and support custom API...
Read more >
Iconify for React
Avaliability of Iconify API is the biggest feature that makes Iconify components different from alternatives. API sends data for icons on demand.
Read more >
Iconify Components
Thousands of icons, one unified framework. Support Iconify · Documentation Icon Web Component. Iconify components.
Read more >
Iconify API Queries
Iconify API supports the following basic queries: ... last modification time of requested icon sets, which can be used to invalidate old icon...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found