我有一个叫MyBundle的捆绑包 . 在公用文件夹的bundle中有css / fontes.css,并且还有fontes文件夹 .
在fontes文件夹中有:sourcesanspro-regular-webfont.eot,sourcesanspro-regular-webfont.woff,sourcesanspro-regular-webfont.ttf,sourcesanspro-regular-webfont.svg,sourcesanspro-bold-webfont.eot,sourcesanspro-bold-webfont .woff,sourcesanspro-bold-webfont.ttf,sourcesanspro-bold-webfont.svg,sourcesanspro-light-webfont.eot,sourcesanspro-light-webfont.woff,sourcesanspro-light-webfont.ttf,sourcesanspro-light-webfont.svg .
在内容fontes.css之上
@font-face {
font-family: 'source_sans_proregular';
src: url('fontes/sourcesanspro-regular-webfont.eot');
src: url('fontes/sourcesanspro-regular-webfont.eot?#iefix') format('embedded-opentype'),
url('fontes/sourcesanspro-regular-webfont.woff') format('woff'),
url('fontes/sourcesanspro-regular-webfont.ttf') format('truetype'),
url('fontes/sourcesanspro-regular-webfont.svg#source_sans_proregular') format('svg');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'source_sans_probold';
src: url('fontes/sourcesanspro-bold-webfont.eot');
src: url('fontes/sourcesanspro-bold-webfont.eot?#iefix') format('embedded-opentype'),
url('fontes/sourcesanspro-bold-webfont.woff') format('woff'),
url('fontes/sourcesanspro-bold-webfont.ttf') format('truetype'),
url('fontes/sourcesanspro-bold-webfont.svg#source_sans_probold') format('svg');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'source_sans_prolight';
src: url('fontes/sourcesanspro-light-webfont.eot');
src: url('fontes/sourcesanspro-light-webfont.eot?#iefix') format('embedded-opentype'),
url('fontes/sourcesanspro-light-webfont.woff') format('woff'),
url('fontes/sourcesanspro-light-webfont.ttf') format('truetype'),
url('fontes/sourcesanspro-light-webfont.svg#source_sans_prolight') format('svg');
font-weight: normal;
font-style: normal;
}
任何人都可以帮助我加载fonte.css和源代码而不使用命令“asset:dump” .
2 回答
您可以将带有字体的文件夹符号链接到
web
文件夹 .您的css在捆绑包的
public/
文件夹中,这使您可以使用带有cssrewrite过滤器的assetic来重写到web下真实路径的路径 . 见Fixing CSS Paths with the cssrewrite Filter您可以使用
web/
文件夹下的符号链接选项安装的所有其他资源,以使其可访问: