Reputation: 562
Can I just add svg icons in the directory /assets/myIcon.svg
and just call the icons as imgs:
<img src="assets/myIcon.svg" >
Also, I am trying to use icons from flaticon. Where should I save the license (a pdf file)?
Upvotes: 1
Views: 1672
Reputation: 147
If you need to use custom icon in your app, here is a solution that worked great for me.
Put your .svg icon file(s) in:
/src/assets/icons/...
In your app.scss file, add this scss code:
ion-icon {
&[class*="prefix-"] {
mask-size: contain;
mask-position: 50% 50%;
mask-repeat: no-repeat;
background: currentColor;
width: 1em;
height: 1em;
}
// custom icons
&[class*="prefix-categories"] {
mask-image: url(../assets/icon/ic_categories.svg);
}
&[class*="prefix-menu"] {
mask-image: url(../assets/icon/ic_menu.svg);
}
}
<ion-icon name="prefix-menu"></ion-icon>
ion-icon.ion-ios-prefix-categories {
padding: 2px;
font-size: 14px;
}
Hope this helps. Anyway about the licensing, I don't know.
Upvotes: 2