cssnode.jsfont-awesome-4

How to use font-awesome in ejs file from node modules?


I have installed font-awesome 4.7 in my nodejs application

I have to get it in my views.ejs file.

i tried importing using tag...

<link rel="stylesheet" href="../node_modules/font-awesome/css/font-awesome.min.css" >

and from css file like this...

@import url('../node_modules/font-awesome/css/font-awesome.min.css');

but they doesn't help....

It is failing to load when looking at the browser's network tab...

Please help.. Thanks in advance!


Solution

  • I have an ejs app in production that uses font awesome and I just use the CDN. But also Atheesh Thirumalairajan post is a valid way. Just make sure you are serving from a public folder.

    <script src="https://kit.fontawesome.com/c03ec31dc2.js" crossorigin="anonymous"></script>