Good afternoon. I'm in troubles a few days ago because I can't load fonts and images that I have stored in public folder.
As you can see, i have a main.scss file that have some variables, font-faces and a mixin.
$primaryGreen: #1e8b22;
$secondaryGreen: #0dee15;
$primaryRed: #962525;
$secondaryRed: #f50404;
$primaryGray: #333333;
$White: #ffffff;
$okGreen: #0dee15;
$errorRed: #f50404;
$alertYellow: #fffb00;
$hintBlue: #0064e7;
$whiteText: #ffffff;
$blackText: #000000;
@font-face {
font-family: logoWhite;
src: url('/public/assets/fonts/JFRocOut.eot') format('opentype');
};
@font-face {
font-family: logoBlack;
src: url('/public/assets/fonts/JFRocSol.TTF') format('truetype');
};
@font-face {
font-family: titleFont;
src: url('/public/assets/fonts/Boogaloo.ttf') format('truetype');
};
@font-face {
font-family: textFont;
src: url('/public/assets/fonts/Baloo2.ttf') format('truetype');
};
@mixin reset {
margin: 0px;
padding: 0px;
}
Well, then I have a navbar.scss, where i call a font-face and an image via url, but they don't work.
@import 'main';
body{
@include reset;
}
#navbar{
height: 61px;
width: 100%;
background-color: $primaryGray;
display: grid;
grid-template-columns: 1fr 3fr 2fr;
}
#logo{
font-family: logoWhite;
text-align: center;
vertical-align: middle;
color: white;
}
#pageBody{
width: screen;
height: 100vh;
display: grid;
grid-template-columns: 1fr 2fr 1fr;
background-image: url('/public/assets/images/Minulogo.png');
}
But fonts and images don't display.
If this helps, my webpack.mix.js is like this:
const mix = require('laravel-mix');
mix.js('resources/js/app.js', 'public/js');
mix.sass('resources/sass/app.scss', 'public/css', {
implementation: require('node-sass')
})
.sass('resources/sass/navbar.scss', 'public/css', {
implementation: require('node-sass')
})
.sourceMaps();