我正在使用laravel mix,我想编译我的字体。我的字体是经过编译的,但它们的名称是从根开始读取的。请看我底部的代码。
@font-face {
font-family: 'icomoon';
src: url('../fonts/product-fonts/icomoon.eot');
src: url('../fonts/product-fonts/icomoon.eot') format('embedded-opentype'),
url('../fonts/product-fonts/icomoon.ttf') format('truetype'),
url('../fonts/product-fonts/icomoon.woff') format('woff'),
url('../fonts/product-fonts/icomoon.svg') format('svg');
font-weight: normal;
font-style: normal;
}这是我的sass代码,最终的编译过程如下:
@font-face {
font-family: 'icomoon';
src: url(/fonts/icomoon.eot?c2f80bad46e9a20b6278361015fef1cd);
src: url(/fonts/icomoon.eot?c2f80bad46e9a20b6278361015fef1cd) format("embedded-opentype"), url(/fonts/icomoon.ttf?5fa3cdef859a193e0f02c75fbd91d73a) format("truetype"), url(/fonts/icomoon.woff?96c27a3f7e16f9927cc8a0d2818c4e8e) format("woff"), url(/fonts/icomoon.svg?6e4d8f919ddb5d210c8807eb99149359) format("svg");
font-weight: normal;
font-style: normal;
}但我想编译以下代码:
@font-face {
font-family: 'icomoon';
src: url(../fonts/icomoon.eot?c2f80bad46e9a20b6278361015fef1cd);
src: url(../fonts/icomoon.eot?c2f80bad46e9a20b6278361015fef1cd) format("embedded-opentype"), url(../fonts/icomoon.ttf?5fa3cdef859a193e0f02c75fbd91d73a) format("truetype"), url(../fonts/icomoon.woff?96c27a3f7e16f9927cc8a0d2818c4e8e) format("woff"), url(../fonts/icomoon.svg?6e4d8f919ddb5d210c8807eb99149359) format("svg");
font-weight: normal;
font-style: normal;
}因为我的css文件在另一个文件夹中
发布于 2019-08-08 02:45:57
尝试设置资源根目录
mix.setResourceRoot('../');
这对我来说工作得很好:)
https://stackoverflow.com/questions/56256963
复制相似问题