Coder Social home page Coder Social logo

Fontawesome $fa-font-path Error about awps HOT 6 CLOSED

alecaddd avatar alecaddd commented on August 19, 2024
Fontawesome $fa-font-path Error

from awps.

Comments (6)

Alecaddd avatar Alecaddd commented on August 19, 2024 8

I did it and it works for me.
These are my steps:

  1. Install via npm npm install --save-dev @fortawesome/fontawesome-free
  2. Update the webpack.mix.js file to automatically copy the font files into the dist folder
mix.copyDirectory( './node_modules/@fortawesome/fontawesome-free/webfonts', './assets/dist/fonts/font-awesome' );
  1. Update the style.scss file of AWPS to set the new font path and import the font-awesome styles:
$fa-font-path: "../fonts/font-awesome" !default;

@import 'node_modules/@fortawesome/fontawesome-free/scss/brands';
@import 'node_modules/@fortawesome/fontawesome-free/scss/regular';
@import 'node_modules/@fortawesome/fontawesome-free/scss/solid';
@import 'node_modules/@fortawesome/fontawesome-free/scss/fontawesome';

from awps.

Celtian avatar Celtian commented on August 19, 2024 5
  1. Install
    yarn add @fortawesome/fontawesome-free
  2. Import into styles
$fa-font-path: '~@fortawesome/fontawesome-free/webfonts';
@import '~@fortawesome/fontawesome-free/scss/brands';
@import '~@fortawesome/fontawesome-free/scss/regular';
@import '~@fortawesome/fontawesome-free/scss/solid';
@import '~@fortawesome/fontawesome-free/scss/fontawesome';

from awps.

iconicfreelancer avatar iconicfreelancer commented on August 19, 2024 2

Thanks Alex, I solved it by updating Webpack.mix.js file to ignore URLs
.options({
processCssUrls: false,
}).version()

from awps.

borodin-dev avatar borodin-dev commented on August 19, 2024 2

I did it and it works for me.
These are my steps:

  1. Install via npm npm install --save-dev @fortawesome/fontawesome-free
  2. Update the webpack.mix.js file to automatically copy the font files into the dist folder
mix.copyDirectory( './node_modules/@fortawesome/fontawesome-free/webfonts', './assets/dist/fonts/font-awesome' );
  1. Update the style.scss file of AWPS to set the new font path and import the font-awesome styles:
$fa-font-path: "../fonts/font-awesome" !default;

@import 'node_modules/@fortawesome/fontawesome-free/scss/brands';
@import 'node_modules/@fortawesome/fontawesome-free/scss/regular';
@import 'node_modules/@fortawesome/fontawesome-free/scss/solid';
@import 'node_modules/@fortawesome/fontawesome-free/scss/fontawesome';

same, but with gulp:

  1. Install via npm npm install --save-dev @fortawesome/fontawesome-free
  2. The open your gulpfile.js and paste task:
    gulp.task('icons', function() {
    return gulp.src('node_modules/@fortawesome/fontawesome-free/webfonts/*')
    .pipe(gulp.dest('app/fonts/font-awesome/'));
    });
  3. After that go to your main SCSS file and paste that code at the top(or after other imported files in your main SCSS file):
    $fa-font-path: "../fonts/font-awesome" !default;
    @import "node_modules/@fortawesome/fontawesome-free/scss/fontawesome";
    @import "node_modules/@fortawesome/fontawesome-free/scss/brands";
    @import "node_modules/@fortawesome/fontawesome-free/scss/regular";
    @import "node_modules/@fortawesome/fontawesome-free/scss/solid";

NOTE: For correct work folders should be named equally. I mean in gulpfile.js path "'app/fonts/font-awesome/'" and in SCSS file the path $fa-font-path: "../fonts/font-awesome"

from awps.

Alecaddd avatar Alecaddd commented on August 19, 2024

You changed the path to ../fonts, are you sure all the font files are inside that folder?
The error is telling you that the compiler can't find the fa-brands-400.eot file.

from awps.

iconicfreelancer avatar iconicfreelancer commented on August 19, 2024

Let me explain, what I am doing, so that you could get better idea of the issue.

  1. Installed font awesome icons using npm
  2. In style.scss I added following code
    `
    $fa-font-path: "../webfonts" !default;

@import "@fortawesome/fontawesome-free/scss/fontawesome";
@import "
@fortawesome/fontawesome-free/scss/solid";
@import "@fortawesome/fontawesome-free/scss/brands";
@import "
@fortawesome/fontawesome-free/scss/regular";`

  1. Web pack copied fonts in my fonts folder

fonts

Now if I use the default path of font awesome as per their documentation “../webfonts” in my css file it shows the

src: url(/fonts/vendor/@fortawesome/fontawesome-free/webfa-solid-900.eot

But when I change path to “../fonts” is shows following in css file but with error in my npm run watch command
src: url(/fonts/vendor/@fortawesome/fontawesome-free/webfa-solid-900.eot

When I am using same process without changing path “../webfonts”, it works fine with laravel.

Please guide, where am I going wrong in this.

from awps.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.