Problem solved mix 4.0
I don't care where my fonts are being placed in public/fonts directory as long as they are being loaded by browser correctly.
I don't care where my fonts are being placed in
public/fontsdirectory as long as they are being loaded by browser correctly.
Good for you. Your answer isn't related with my question..
There is a $fa-font-path variable in font-awesome. You can change the output path, just add to your scss before font-awesome import but I'm not sure if laravel mix can copy them to new folder for you. You may have to copy font files from node_modules via mix.copyDirectory()
It's not related to font-awesome, I'm talking about fonts in general. I just need change the path... How?
I wonder that myself. I would like to publish fonts to public/assets/fonts. I tried to mix.copy public/fonts to public/assets/fonts but that does not fix the font file paths in the compiled css files (url(/fonts…).
Overwrite fileLoaderDirs.fonts in webpack.mix.js worked for me:
let mix = require('laravel-mix');
mix.config.fileLoaderDirs.fonts = 'assets/fonts';
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Overwrite
fileLoaderDirs.fontsinwebpack.mix.jsworked for me:let mix = require('laravel-mix'); mix.config.fileLoaderDirs.fonts = 'assets/fonts';
Since the version 6, this solution not working anymore. Do:
let mix = require('laravel-mix');
mix.options({
fileLoaderDirs: {
fonts: 'assets/fonts'
}
});
Overwrite
fileLoaderDirs.fontsinwebpack.mix.jsworked for me:let mix = require('laravel-mix'); mix.config.fileLoaderDirs.fonts = 'assets/fonts';Since the version 6, this solution not working anymore. Do:
let mix = require('laravel-mix'); mix.options({ fileLoaderDirs: { fonts: 'assets/fonts'; } });
Thank you @ytilotti! fyi it might be a typo (comma instead of semicolon), best
let mix = require('laravel-mix');
mix.options({
fileLoaderDirs: {
fonts: 'assets/fonts',
}
});
Thanks @michaldoda, I edited! A beautiful typing error^^
Most helpful comment
Good for you. Your answer isn't related with my question..