Install Font Awesome 5 with NPM

后端 未结 5 509
-上瘾入骨i
-上瘾入骨i 2021-02-03 19:21

I am working with Angular(6) application, and I am trying to use FA icons, and drop-down with no luck. I am successfully using FA(4) icons, like:



        
5条回答
  •  梦如初夏
    2021-02-03 20:05

    For version 5, you need following package @fortawesome/fontawesome. See installation using package managers.

    Using npm:

    npm install --save @fortawesome/fontawesome-free
    

    Then reference either the all.css or all.js in the .

    
    

    Note: Make sure the path is right, depends on where you installed the package from.

    OR you can import the module in your js code.

    import '@fortawesome/fontawesome-free/js/all.js';
    

    OR if you are using Sass, you can import the module in app.scss.

    @import '~@fortawesome/fontawesome-free/scss/fontawesome';
    @import '~@fortawesome/fontawesome-free/scss/';
    

    Note: Replace with solid, brands or regular whatever type of icons you need.


    Font Awesome has an official Angular component.

    npm install --save @fortawesome/fontawesome-svg-core
    npm install --save @fortawesome/free--svg-icons
    npm install --save @fortawesome/angular-fontawesome
    

    Note: Replace with solid, brands or regular whatever type of icons you need.


    You can also install Vue and React components.

    npm install --save @fortawesome/vue-fontawesome
    npm install --save @fortawesome/react-fontawesome
    

提交回复
热议问题