Laravel Mix generate fonts into another directory

If you want to use the laravel-mix and try to change public/fonts to public/assets/fonts directory, You can use this code in your webpack.mix.js

let mix = require('laravel-mix');
mix.config.fileLoaderDirs.fonts = 'assets/fonts';

1. First Create a explicit folder structure:

like this in your laravel project.

public/fonts/vendor/font-awesome

Move all your fonts from font-awesome package to above mention directory.

2. Change $fa-font-path variable value:

font-awesome directory has a file called _variables.scss inside that file there is a variable named as $fa-font-path change the value to something like this.

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

Compile your assets it would work.


Try to copy them directly like this:

mix.copyDirectory('assets/font-awesome/webfonts', 'public/fonts');

Or you can copy files one by one:

mix.copy('assets/font-awesome/webfonts/example.ttf', 'public/fonts/example.ttf');