I have installed "@fortawesome/fontawesome-free": "5.2.0"
through package.json
to my new project. It installs in root directory node_modules\@fontawesome\etc.
Now that I have added this to my _Layout.cshtml
like <link href="~/vendor/fortawesome/fontawesome-free/css/all.css" rel="stylesheet" />
Now fonts are not working as supporting files were installed under folder @fontawesome
. If I change from @fontawesome
to fontawesome
it works well but system re-installing entire supporting files again to node_modules\@fontawesome\etc.
Please suggest a way to avoid this.
Here is my startup.cs
file
app.UseStaticFiles(new StaticFileOptions()
{
FileProvider = new PhysicalFileProvider(
Path.Combine(Directory.GetCurrentDirectory(), @"node_modules")),
RequestPath = new PathString("/vendor")
});
If I link as it is path like <link href="~/vendor/@fortawesome/fontawesome-free/css/all.css" rel="stylesheet" />
the error is "The name fortawesome does not exist in current context."
I renamed @fontawesome
to fontawesome
and made my link as
<link href="~/vendor/fortawesome/fontawesome-free/css/all.css" rel="stylesheet" />
System re-installed to @fontawesome
, I just uninstalled fontawesome
from npm
has uninstalled newly created folder with @fontawesome
but physical files available for that of I renamed.
Its working fine for me. And Yes, this may not be the correct way but it works.