Rails:基础图标应该在生产中使用。。。但它没有';T 我遵循了互联网上的每一个教程,使基础图标在生产模式下工作,但每次我都失败了。 我不想使用任何gemify css库,如果rails不为这些资产提供服务,那么它将根本不起作用 #app/assets/fonts - foundation-icons.eot - foundation-icons.svg - foundation-icons.ttf - foundation-icons.woff #app/assets/stylesheets/foundation-icons @font-face { font-family: "foundation-icons"; src: font-url("foundation-icons.eot"); src: font-url("foundation-icons.eot?#iefix") format("embedded-opentype"), font-url("foundation-icons.woff") format("woff"), font-url("foundation-icons.ttf") format("truetype"), font-url("foundation-icons.svg#fontcustom") format("svg"); font-weight: normal; font-style: normal; } .fi-address-book:before, .... #config/application.rb config.assets.precompile << /\.(?:svg|eot|woff|ttf)$/
我获得:Rails:基础图标应该在生产中使用。。。但它没有';T 我遵循了互联网上的每一个教程,使基础图标在生产模式下工作,但每次我都失败了。 我不想使用任何gemify css库,如果rails不为这些资产提供服务,那么它将根本不起作用 #app/assets/fonts - foundation-icons.eot - foundation-icons.svg - foundation-icons.ttf - foundation-icons.woff #app/assets/stylesheets/foundation-icons @font-face { font-family: "foundation-icons"; src: font-url("foundation-icons.eot"); src: font-url("foundation-icons.eot?#iefix") format("embedded-opentype"), font-url("foundation-icons.woff") format("woff"), font-url("foundation-icons.ttf") format("truetype"), font-url("foundation-icons.svg#fontcustom") format("svg"); font-weight: normal; font-style: normal; } .fi-address-book:before, .... #config/application.rb config.assets.precompile << /\.(?:svg|eot|woff|ttf)$/,css,ruby-on-rails,production-environment,Css,Ruby On Rails,Production Environment,我获得: #public/assets/ - foundation-icons-7eadaa6a15e069d84c07540345524b0e.eot - foundation-icons-7eadaa6a15e069d84c07540345524b0e.ttf - foundation-icons-7eadaa6a15e069d84c07540345524b0e.woff - foundation-icons-ffbd67b2d
#public/assets/
- foundation-icons-7eadaa6a15e069d84c07540345524b0e.eot
- foundation-icons-7eadaa6a15e069d84c07540345524b0e.ttf
- foundation-icons-7eadaa6a15e069d84c07540345524b0e.woff
- foundation-icons-ffbd67b2dc2f5e03fca68691f97f051d.svg
我的页面布局将呈现sprokets清单
<%= stylesheet_link_tag "main/manifest/about_manifest" %>
如果我看一下我的about_manifest-90e09360ea22dff94eb45a5550df521b.css
@font-face {
font-family: "foundation-icons";
src: url(/assets/foundation-icons-7eadaa6a15e069d84c07540345524b0e.eot);
src: url(/assets/foundation-icons-7eadaa6a15e069d84c07540345524b0e.eot?#iefix) format("embedded-opentype"), url(/assets/foundation-icons-7eadaa6a15e069d84c07540345524b0e.woff) format("woff"), url(/assets/foundation-icons-7eadaa6a15e069d84c07540345524b0e.ttf) format("truetype"), url(/assets/foundation-icons-ffbd67b2dc2f5e03fca68691f97f051d.svg#fontcustom) format("svg");
font-weight: normal;
font-style: normal; }
当我在生产中与
RAILS_ENV=production rails s
我的chrome控制台中没有任何警告。找到所有资源,但我的图标看起来像正方形。
包含图标的代码为
<i class="fi-mail"></i>
#production.rb
config.serve_static_assets = true #This one will be false with passenger
config.assets.digest = true
config.assets.compile = false
#production.rb
config.service_static_assets=true#对于乘客,此选项将为false
config.assets.digest=true
config.assets.compile=false
请帮忙。
PS:我还应该说,我的文本使用了自定义字体,效果非常好。你有没有尝试过清除浏览器缓存?我简直不敢相信!成功了,谢谢:-)但怎么可能呢?我已经预编译了很多次字体,通常他们每次都会得到不同的摘要代码,所以我的浏览器怎么能缓存这么长时间呢?
RAILS_ENV=production rails s
<i class="fi-mail"></i>
#production.rb
config.serve_static_assets = true #This one will be false with passenger
config.assets.digest = true
config.assets.compile = false