我无法在我的正式服务器上加载在本地服务器上完美运行的 Bootstrap 3 Glyphicons 字体。
我已经尝试了 Stack Overflow 上的各种方法,但仍然无法解决问题。
以下是我的操作步骤:
applicatin.css.scss
@import "bootstrap-sprockets";
@import 'home';
@import "bootstrap";
@font-face {
font-family: 'Glyphicons Halflings';
src: url("/assets/bootstrap/glyphicons-halflings-regular.eot");
src: url("/assets/bootstrap/glyphicons-halflings-regular.eot?#iefix") format("embedded-opentype"),
url("/assets/bootstrap/glyphicons-halflings-regular.woff2") format("woff2"),
url("/assets/bootstrap/glyphicons-halflings-regular.woff") format("woff"),
url("/assets/bootstrap/glyphicons-halflings-regular.ttf") format("truetype"),
url("/assets/bootstrap/glyphicons-halflings-regular.svg#glyphicons_halflingsregular") format("svg");
}
我目前尝试过的方法:
@import "bootstrap-sprockets";
@import 'home';
@import "bootstrap";
@font-face {
font-family: 'Glyphicons Halflings';
src: url("/assets/bootstrap/glyphicons-halflings-regular.eot");
src: url("/assets/bootstrap/glyphicons-halflings-regular.eot?#iefix") format("embedded-opentype"),
url("/assets/bootstrap/glyphicons-halflings-regular.woff2") format("woff2"),
url("/assets/bootstrap/glyphicons-halflings-regular.woff") format("woff"),
url("/assets/bootstrap/glyphicons-halflings-regular.ttf") format("truetype"),
url("/assets/bootstrap/glyphicons-halflings-regular.svg#glyphicons_halflingsregular") format("svg");
}
并且
@import "bootstrap-sprockets";
@import 'home';
@import "bootstrap";
@import url("http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css");
并且
@import "bootstrap-sprockets";
@import 'home';
@import "bootstrap";
@import url("//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css");
并且
@import url("http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css");
@import "bootstrap-sprockets";
@import 'home';
@import "bootstrap";
并且
@import url("//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css");
@import "bootstrap-sprockets";
@import 'home';
@import "bootstrap";
但是所有这些方法对我都没有用,但它们在本地服务器上运行良好。
http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css
后,是否预编译了资产? - Amit BadhekaRAILS_ENV=production rake assets precompile
在本地编译资源,然后在演示环境上更新和检查。最后将代码更新到生产环境。 - Amit Badheka