How to import the same icon from solid and regular library ?
See original GitHub issueDescribe the problem
I want to import “faStar” from the regular AND solid library. There is no example in the documentation to do this.
If i try to do :
import { faStar } from '@fortawesome/free-regular-svg-icons';
import { faStar } from '@fortawesome/free-solid-svg-icons';
I got an error because it’s duplicate.
I end up using this solution but i don’t know if it’s the rigth way…
import { faStar as farStar } from '@fortawesome/free-regular-svg-icons';
import { faStar as fasStar } from '@fortawesome/free-solid-svg-icons';
...
library.add(fasStar);
library.add(farStar);
...
<fa-icon [icon]="['fas', 'star']"></fa-icon>
<fa-icon [icon]="['far', 'star']"></fa-icon>
What did you expect?
A tip to import an icon from both free library without importing all “far” and “fas” like this :
import { library } from '@fortawesome/fontawesome-svg-core';
import { fas } from '@fortawesome/free-solid-svg-icons';
import { far } from '@fortawesome/free-regular-svg-icons';
library.add(fas, far);
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (1 by maintainers)
Top Results From Across the Web
How to use same icon regular and solid type - Stack Overflow
Try this: import { faBell } from '@fortawesome/free-solid-svg-icons/faBell'; import { faBell as anotherFaBell } from ...
Read more >Import Icons | Font Awesome Docs
Here's a primer on Font Awesome icon naming and how to import from icon content ... Sharp, and Brands) as well as 5...
Read more >Using other styles | angular-fontawesome - GitHub Pages
Import the icon from the installed package and use it in your application using either icon library or explicit references approach.
Read more >vue-fontawesome - JavaScript
Import the specific icons that you need; Import the same icon from different ... on how to display Solid, Regular, and Brand icons...
Read more >Font Awesome icons in Vue.js apps: A complete guide
import { library } from '@fortawesome/fontawesome-svg-core'; import { faPhone } from "@fortawesome/free-solid-svg-icons"; import { faJs, faVuejs } ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi, I tested and final bundle is the same:
vs
I just see that aliases are used in the stackblitz example… It’s just a missing doc issue so 👍
I haven’t the time now cause of Christmas but here is my example :
Adding an icon from both Regular and Solid style: