danny
danny

Reputation: 457

font-awesome in vue project is not working

I need to use font-awesome in my vue project to show some icon. First, I installed font-awesome in my project.

npm install font-awesome --dev-save

After installed, it didn't work, just displayed as a square instead icon. The error reason is the font file for font-awesome can't be loaded successfully.

Upvotes: 1

Views: 2981

Answers (2)

Richard Matsen
Richard Matsen

Reputation: 23463

You should be able to use the fonts just by including

import 'font-awesome/css/font-awesome.min.css

in main.js.

Upvotes: 0

danny
danny

Reputation: 457

After investigation, I copied these font file to a new folder, and reset the variable $fa-font-path's value, like below:

// reset font-awesome variables
$fa-font-path:                    '/src/common/fonts'

And it works well. Hope could help.

Upvotes: 1

Related Questions