-
Notifications
You must be signed in to change notification settings - Fork 2.1k
ionic 4 custom icons #589
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@chukwu Custom icons would also be svg. Here is an example of a custom icon: https://aetabs.adaept.com/tabs/(contact:contact) Documentation is behind the curve but being worked on by the ionic team 😄 |
@peterennis
Now this does not work. |
This comment has been minimized.
This comment has been minimized.
You can slightly modify the build config to add new icons to the ionicons library, and use them anywhere.
See how it's packaging all the svg files from the ionic library into
The svg image should consist of shapes with black fills. Strokes won't always show up, depending on the context.
|
@ransoing .... I'll try this. If it works, then I'm all set for migration. It actually looks easier this way than IONIC 3. The next big thing would be to modify my CSS nestings due to shadow DOM restrictions. Thanks mate. |
Giving it a little bit more thought, it would be better to put your |
I've discovered that this may not work properly if your custom svg file defines any colors. The ionic framework overrides svg fill colors with CSS, and defining colors in the svg file may prevent ionic from setting colors properly. |
This comment has been minimized.
This comment has been minimized.
@ransoing Your approach is the most elegant, but for me it works on first load. As soon as I reload the app I get the GET http://localhost:8100/svg/ios-message.svg 404 (Not Found) error. I've set up a custom-ion-icons folder as sibling to src folder with an ios-message.svg and a md-message.svg. angular.json:
I guess you could always do something like Anyone any thoughts on why it only works on initial load ? |
@RollyPeres does it work properly if you put your |
i sloved it. detail in https://gist.github.com/anyangdp/198644c744cac6d5236b00463990eb10 |
@anyangdp will check it out. Nice! |
@anyangdp @RollyPeres |
@ransoing Thanks your solution worked! However importing google material icons, it imports with a square box around it. Is this normal? I'm importing 24DP svgs. |
@bkarv did you find a solution to this problem. I have the same issue. A black box around the svg. |
@johnbrattaker |
So has anyone been able to do this with a .png image ? In V3 i was able to do it with a hack like below in app.scss
|
If it's still relevant. I've found a solution. The border box is actually part of the svg of the material icon when you download it. You can open it in any text editor and delete the rectangle path that looks something like this: |
|
any suggestion with vue.js? 🙏 |
How to put the www file directly into your Objective-C project ? |
Anyone have a good solution to using Font Awesome icons? They don't bundle svg files AFAICT, it's a js file that exports the svg path... Edit: Of course once I break down to ask for help I figure it out 🙄 I used @ransoing's approach and to make Font Awesome work I downloaded the desktop version of the icons which includes the svg icons. I then duplicated the svg I wanted and prefixed it with |
For Ionic v5 the above solution still works, but the Thanks heaps @ransoing ! |
@SimonBrazell I got this to work in v5 as well but the custom icons only show when I serve my app using ‘ionic serve -l’ Is there something else I need to do? EDIT: I was able to get this working by starting a new app and copying the angular.json file, deleting the node_modules folder and running npm install again, but I cannot style any of the custom icons. For example, I cannot set the color to red. |
@mikev10 it all worked fine for me, I however varied the instructions for my project slightly by putting my custom icons in My
If you are having problems colouring the icons then perhaps the problem lies with SVGs themselves, note this part of @ransoing's instructions:
|
@SimonBrazell |
@peterennis yes this implementation all worked fine for me, colours and everything worked as expected e.g.
You don't need to worry about creating |
@SimonBrazell It is working. See this commit: adaept/ae-icon5-component@38133e3 |
@SimonBrazell Thanks man. I was using those ios- and md- prefixes. Removing them solved it. Thanks again. |
@SimonBrazell Thanks so much for this. One tip that might help others out was that my SVGs had |
I share the information. |
@SimonBrazell Thanks for your work. |
@langy Thanks for this.
How can I remove the attribute from SVG element? Please help me. |
Hi @zhiyilee, you can try open the SVG file in a text editor and look for the See below (one of the Ionicons) how each of the elements within the
|
If you're here you'll also need ``
You now need |
Consolidating into #1448 |
Migrating from ionic 3 to ionic 4 doesn't look and feel as easy as the ionic team say.
Without a documentation or tutorial, migrating would be a waste of my time. Alot has changed and thus far, this seems to be the most painful
The text was updated successfully, but these errors were encountered: