Import all icons from a single type #64
Answered
by
ashley-hunter
juancarlosgzs
asked this question in
Q&A
-
Hello! First of all: Great job! Loving it so far! This is something Angular has been missing for quite a lot of time and you have plenty of options in other frameworks. Anyway, I was wondering if there is a way to get all the icons from a single library such as Ionicons or any other, without having to import individually every single icon. Thanks! |
Beta Was this translation helpful? Give feedback.
Answered by
ashley-hunter
Aug 30, 2023
Replies: 1 comment 2 replies
-
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
juancarlosgzs
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi! Thank you very much, I'm glad you are finding it useful!
Yes, you can indeed, you just need to import using
*
from the package:You then register the icons like this:
While convenient, be warned that icons individually imported to improve bundle size, importing all tabler icons will have an effect on you applications size:
A better way might be to have an single
provideIcons
at the root of your application when add all icons you are actually using there, that way you only have to import them once rather than in every component/ng module. This would help with reducing the bundle size.Regardless, here is an example…