christopher's avatar

Laravel Mix font path is wrong

I am using Laravel Mix as a standalone version. So - I am copying all my files from a src folder to dist:

mix.js('src/javascript/app.js', 'dist/js')
    .sass('src/scss/app.scss', 'dist/css')
    .copyDirectory('src/img', 'dist/img')
    .copyDirectory('src/fonts', 'dist/fonts')
   ....

In my app.scss i am declaring my fonts:

@font-face {
    font-family: 'Avenir';
    src: url('../fonts/thefont.eot?#iefix');
    ....

Notice the .... If i now run yarn run prod the path to the fonts in my app.css is wrong. In my app.css i am getting the following code

/fonts/...

But the app.css lives in dist/css/app.css so the fonts cant be loaded because they're two directories before.

Mix copies the directory img to the root with the name of images and copies also the font folder to the root directory. Not to the dist directory.

Can anyone tell me what i am doing wrong here?

0 likes
2 replies
Simon39's avatar

This question looks pretty old, but I've run into a similar problem, try adding to the options object processCssUrls: false

mix.options({
        processCssUrls: false,
})

it solved my problem.

Please or to participate in this conversation.