Import all icons #5815
-
Is it possible to import all icons at once or by category? Instead of importing it one by one like this: import { ClarityIcons, userIcon } from '@cds/core/icon';
ClarityIcons.addIcons(userIcon); |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi @ph55 - great question and I hope my answer doesn't disappoint you to much. In short, no there isn't a utility to load all icons at once. Here is why: When |
Beta Was this translation helpful? Give feedback.
-
Printed all the icons , incase someone wants to include all
|
Beta Was this translation helpful? Give feedback.
Hi @ph55 - great question and I hope my answer doesn't disappoint you to much. In short, no there isn't a utility to load all icons at once. Here is why:
When
clr-icons
's were re-written as part of the@cds/core
library it was set up the way you show above for performance and optimization benefits. There is no load all icons utility because we have no way of knowing which icons are used or not used in an application. Importing and then adding only the icons that are needed ensures that proper tree shaking can occur during application builds so tooling is able to see which icons are imported. and tree-shake the rest away.