我项目中的所有javascript依赖项都由bower管理。我使用bower-installer来过滤掉所需的资源。其中一个是bootstrap,其中包含一些字体,请参阅凉亭配置:
{
...
"install":{
"path":{
"js":"public/js/lib",
"map":"public/js/lib",
"css":"public/css/lib",
"less":"public/less",
"eot":"public/fonts",
"svg":"public/fonts",
"ttf":"public/fonts",
"woff":"public/fonts"
},
...
"sources":{
"bootstrap":[
".components/bootstrap/dist/js/bootstrap.min.js",
".components/bootstrap/dist/fonts/glyphicons-halflings-regular.eot",
".components/bootstrap/dist/fonts/glyphicons-halflings-regular.svg",
".components/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf",
".components/bootstrap/dist/fonts/glyphicons-halflings-regular.woff",
".components/bootstrap/dist/css/bootstrap.min.css"
],
}
问题是,在给定配置下,bower将所选字体资源放入以下目录:public/fonts/bootstrap/...
但是bootstrap.min.css
要求这些字体的位置如下:
@font-face {
font-family: 'Glyphicons Halflings';
src: url('../fonts/glyphicons-halflings-regular.eot');
src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/glyphicons-halflings-regular.woff') format('woff'), url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg');
}
将是public/css/lib/fonts/...
,因此返回404未找到。有没有办法在bower中覆盖这些路径或覆盖应用程序css中的字体定义?