简体   繁体   English

Rails bootstrap-sass字体404错误

[英]rails bootstrap-sass font 404 error on staging

I have some problems with bootstrap glyphicons font on staging env with rails. 我在使用rails扩展env时遇到引导glyphicons字体问题。 The server could find font files before, just recent the server suddenly could not find those font files after deploying with capistrano on staging (I am pretty sure I have not made any changes on config files, the only changes are js files and some ui to prof that I rolled back to last working revision but glyphicons still cannot show up). 服务器之前可以找到字体文件,只是最近服务器在使用capistrano进行分阶段部署后突然找不到那些字体文件(我很确定我没有对配置文件进行任何更改,唯一的更改是js文件和一些ui我回滚到上一个有效修订版,但glyphicons仍然无法显示)。

By looking through log files, I found out the precompile is working properly. 通过查看日志文件,我发现预编译工作正常。 The assets precompile will create several font files in the directory /public/assets/bootstrap/ names are: 资产预编译将在目录/public/assets/bootstrap/创建几个字体文件,名称为:

glyphicons-halflings-regular-<digest>.eot
glyphicons-halflings-regular-<digest>.woff2
glyphicons-halflings-regular-<digest>.svg
glyphicons-halflings-regular-<digest>.svg.gz
glyphicons-halflings-regular-<digest>.woff
glyphicons-halflings-regular-<digest>.ttf

I also start server up and login to the page with glyphicons. 我也启动服务器并使用glyphicons登录页面。 By looking through "Network" tab in browser console. 通过浏览器控制台中的“网络”标签查看。 I found 404 error: 我发现404错误:

.../assets/bootstrap/glyphicons-halflings-regular.woff2

I realise server could not find *.woff2 files because of server not finding the correct name (missing <digest> ) glyphicons-halflings-regular-<digest>.woff2 我意识到服务器找不到* .woff2文件,因为服务器找不到正确的名称(缺少<digest>glyphicons-halflings-regular-<digest>.woff2

I searched and tried a lot of methods but still not working. 我搜索并尝试了很多方法,但仍然无法正常工作。 A guy on stackoverflow is asking the same question: fontawesome icons with twitter-bootstrap-rails doesn't show on staging environment 一个在stackoverflow上的家伙问了一个同样的问题: 带有暂存器环境的带twitter-bootstrap-rails的字体图标不显示

But my rails version is 4.1.6 aready 但是我的rails版本是4.1.6 Aready

ruby: 1.9.3
gem 'bootstrap-sass', '=3.3.6' # the latest version under ruby 2.0
gem 'sass', '>=3.4.7'# the latest version working with bootstrap-sass
gem 'sass-rails', '>=5.0.0.beta1'  

Thanks for helping me. 谢谢你帮我

Have you rename application.css to application.scss and add in : 您是否将application.css重命名为application.scss并添加:

@import "bootstrap-sprockets";
@import "bootstrap";

Best regards. 最好的祝福。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM