Skip to content
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

Ability to use vue-fontawesome library with custom SVG path #274

Open
vbaulac opened this issue Dec 14, 2020 · 3 comments
Open

Ability to use vue-fontawesome library with custom SVG path #274

vbaulac opened this issue Dec 14, 2020 · 3 comments

Comments

@vbaulac
Copy link

vbaulac commented Dec 14, 2020

Hello,

I am kind of re-opening this issue (#93), that was closed 2 years ago. The neat workaround described by Joshua doesn't work anymore.

The workaround :

It's the same code you would use in the FontAwesome JavaScript library elsewhere. Define the icon using their format {prefix, name, icon: [width, height, [ligatures], unicode, path]}. Then add that object to your library.

/* icons.js */
export const faMyIcon= { prefix: 'fac', iconName: 'my-icon', icon: [512, 512, [], null, "{your-merged-path-data}"] };

/* app.js */
import { library } from '@fortawesome/fontawesome-svg-core'
import { faMyIcon } from "@app/icons"
library.add(faMyIcon)

But now, the prefix & iconName are strictly defined. So we can't add an icon to the library with "fac" prefix and "foobar" iconName.

export type IconPrefix = "fas" | "fab" | "far" | "fal" | "fad";

What would be the clean way to use one of my custom SVG icon, using the vue-fontawesome library ?

Thanks in advance

@Aareksio
Copy link

Hi! I was looking for official method to add custom SVG in my vue project and stumbled onto this open issue. After a little more research I found the official guide along with TypeScript example. I am positive OP have moved on long time ago, but for anyone else fighting their tools interested, hope this helps!

@HassanZahirnia
Copy link

@Aareksio I'm looking for a way to import/add svg files as inline so I can change their color and style them. Do you happen to know or have a way to do this? I wish I could just import all my svg files that are located in resources/svg and use them where ever I want.

@ricardoboss

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants