7 months ago

Laravel Mix font path is wrong

Posted 7 months ago by christopher

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


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?

Please sign in or create an account to participate in this conversation.