How to use awesome 5 font installed through NPM

I do not find any documents for what to do next, I installed in my project through npm,

$ npm install --save @fortawesome/fontawesome-free-webfonts

But what now? Can someone tell me how to actually import or use it now? Thanks.

+5
source share
1 answer

To use the npm module on your interface, you will need to do something like transpiling with webpack, gulp, or, most likely, grumble.

Then, at the entry point of your application, before you write html / jsx / some other html-esque code, you will need to require or import the css file from the amazing npm font module.

 // es6/babel import import 'font-awesome/css/font-awesome.min.css'; // browserify require statement if not using babel/es6 require('font-awesome/css/font-awesome.min.css'); 

For example, this is a response application that I made with webpack / babel, and in the entry point file I import the css file from the awesome font: https://github.com/AkyunaAkish/akyuna_akish/blob/master/client/index. js

FYI: I used

 npm install --save font-awesome 

Instead of the command you used. You may need to adjust the path of the import / require file to point to the main css file in your awesome node_module package if we have slightly different packages.

-1
source

Source: https://habr.com/ru/post/1274512/


All Articles