如何添加资产/字体文件夹以进行预编译?将字体添加到预编译
目前,我有以下几点:
config.assets.precompile += %w(saas_admin.css saas_admin.js stripe_form.js fonts)
它不工作,我应该把资产/字体代替?
mystyle.css.erb
@font-face {
font-family: 'SourceSansPro-Regular';
src: url('SourceSansPro-Regular.eot?') format('eot'),
url('SourceSansPro-Regular.otf') format('opentype'),
url('SourceSansPro-Regular.woff') format('woff'),
url('SourceSansPro-Regular.ttf') format('truetype'),
url('SourceSansPro-Regular.svg#SourceSansPro-Regular') format('svg');
font-weight: normal;
font-style: normal;
}
@font-face{
font-family: 'MyriadProRegular';
src: url('myriadpro-regular-webfont.eot');
src: local('?'), url('myriadpro-regular-webfont.woff') format('woff'),
url('myriadpro-regular-webfont.ttf') format('truetype'),
url('myriadpro-regular-webfont.svg#webfont8y9VojoZ') format('svg');
font-weight: normal;
font-style: normal;
}
请帮帮忙!
试试这个'config.assets.precompile <\。(? :svg | eot | woff | ttf)$ /' –
谢谢!试着,随着:config.assets.paths << Rails.root.join('应用程序','资产','字体') 它仍然不是预编译:( – user3399101
将大写字母改为小写,'SourceSansPro-经常更改为'sourcesanspro-regular' http://stackoverflow.com/a/10907276/1297435 –