我bootstrap-sass
在Rails 4应用程序中使用了gem,并且使用了随引导程序一起提供的Glpyphicons字体,用于我的应用程序中的图标。在开发中,这些图标显示良好。但是,在任何非开发环境中,每次对Glyphicon字体文件的引用都会出现404错误。
我已经确定这是由于资产管道破坏了Bootstrap样式表中的引用而导致的指纹识别。
Bootstrap会引用这些字体,例如:
@font-face {
font-family: 'Glyphicons Halflings';
src: url("bootstrap/glyphicons-halflings-regular.eot");
src: url("bootstrap/glyphicons-halflings-regular.eot?#iefix") format("embedded-opentype"), url("bootstrap/glyphicons-halflings-regular.woff") format("woff"), url("bootstrap/glyphicons-halflings-regular.ttf") format("truetype"), url("bootstrap/glyphicons-halflings-regular.svg#glyphicons_halflingsregular") format("svg");
}
但是,快速浏览ls
bootstrap文件夹会显示名称不同。
glyphicons-halflings-regular-293ade90ddeb5ceccd08b9b32ae97010.eot
glyphicons-halflings-regular-533d84fb5d3948367e1b51dde3a08b39.svg
glyphicons-halflings-regular-d381f367f3f48c9f7f775a043238f0f8.ttf
glyphicons-halflings-regular-e5b007f195d752fa4823febe5e66ef4e.woff
如您所见,每个文件都有一个指纹。
删除这些指纹可解决此问题。但是,手动执行此操作不是部署的理想选择。有人对此有任何解决方案吗?bootstrap-sass
如果可以的话,我想避免编辑gem代码。
谢谢!
在您的application.css.scss文件(或模板包含的任何.css文件)中
你需要
@import "bootstrap-sprockets";
@import "bootstrap";
我认为您错过了导入bootstrap-sprockets文件。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句