How to make Font awesome 5 work with webpack

前端 未结 7 1624
野性不改
野性不改 2021-01-30 16:33

I\'m trying to use Fontawesome in my Flask/webpack project.

The craziest thing is some point it worked then stopped, I changed something stupid, it worked again and fina

7条回答
  •  粉色の甜心
    2021-01-30 17:36

    This is what worked for me.

    Taken from the user @ahbou on the webpacker issues page https://github.com/rails/webpacker/issues/619#issuecomment-430644035

    on your console

    yarn add @fortawesome/fontawesome-free
    

    inside your .scss file

    $fa-font-path: '~@fortawesome/fontawesome-free/webfonts'; 
    @import '~@fortawesome/fontawesome-free/scss/fontawesome';
    @import '~@fortawesome/fontawesome-free/scss/solid';
    @import '~@fortawesome/fontawesome-free/scss/regular';
    

提交回复
热议问题