question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

installing awesome-font on with npm, wrong output url

See original GitHub issue
  • Laravel Mix Version: 1.5.1
  • Node Version 8.7.0
  • NPM Version 5.5.1
  • OS: Windows 10 64 bits

Description:

Hello,

trying to install the font-awesome with npm and when compiling

1. First the fonts are copied by default to the folder public/fonts/vendor/font-awesome I do not want that, normally they should be copied directly to the folder public/fonts, according to the different tutorials I read folder.

2. Second when compiling with npm run dev command, the output url to my images in my app.css file cannot be resolved, a relative path are wrong.

i get this : src: url("/fonts/vendor/font-awesome/fontawesome-webfont.eot?v=4.7.0");

instead of src: url("../fonts/vendor/font-awesome/fontawesome-webfont.eot?v=4.7.0");

the “…” in prefix are missing, I have to add them manually after compilation, to have a nice display of my fonts

Steps To Reproduce:

installing awesome font with npm

npm install awesome-font --save-dev

importing fonts in my app.scss file

//font awesome
@import "node_modules/font-awesome/scss/font-awesome";

the variable $fa-font-path is setted in _variables.scss of my font-awessome

$fa-font-path: "~/fonts" !default;

compiling of my css file and JavaScript with the command npm run dev

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

19reactions
denissceluikocommented, Jul 1, 2018

Maybe a bit neater solution that works for fas 5.1.:

npm install --save-dev @fortawesome/fontawesome-free

sass/app.scss:

// Variables
@import "variables";

// Fonts
@import "~@fortawesome/fontawesome-free/scss/fontawesome";
@import "~@fortawesome/fontawesome-free/scss/fa-solid";

Note that variable import is above fas import, that is important.

_sass/variables.scss $fa-font-path: "/fonts"; Add this somewhere.

webpack.mix.js

mix.copy('node_modules/@fortawesome/fontawesome-free/webfonts', 'public/fonts')
   .sass('resources/assets/sass/app.scss', 'public/css');

Here order is also important.

And at last npm run dev

9reactions
aityahiaidircommented, Nov 7, 2017

@artemsky I read the doc of font awesome, but the problem does not come from the installing way, it’s happens also with importing of others library having resources in public path.

I solved the problem by adding mix.setPublicPath('../') to my webpak.mix JS

Read more comments on GitHub >

github_iconTop Results From Across the Web

installing awesome-font on with npm, wrong output url #1292
when compiling with npm run dev command, the output url to my images in my app.css file cannot be resolved, a relative path...
Read more >
Error using `npm install font-awesome` - Stack Overflow
I tried installing Font Awesome using npm ...
Read more >
Install Manually | Font Awesome Docs
This documentation describes customizing WordPress by adding PHP code to your theme's functions.php file. It's intended to be used by more advanced ...
Read more >
@fortawesome/angular-fontawesome - npm
Start using @fortawesome/angular-fontawesome in your project by running `npm i ... Install. npm i @fortawesome/angular-fontawesome ...
Read more >
How to use font-awesome icons from Node.js-modules?
It also gives us to use animations without the use of javascript. Syntax for Installing the library: npm install font-awesome --save. Approach:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found