fontawesome icons with twitter-bootstrap-rails doesn't show on staging environment

眉间皱痕 提交于 2020-01-06 12:51:15

问题


Rails (3.1.2) application with the twitter-bootstrap-rails (2.2.8) gem. The application uses font awesome icons in views. The application.css.scss contains

@import "bootstrap_and_overrides";

bootstrap_and_overrides.css.less

@import "twitter/bootstrap/bootstrap";
@import "twitter/bootstrap/responsive";

// Set the correct sprite paths
@iconSpritePath: image-url("twitter/bootstrap/glyphicons-halflings.png");
@iconWhiteSpritePath: image-url("twitter/bootstrap/glyphicons-halflings-white.png");

// Set the Font Awesome (Font Awesome is default. You can disable by commenting below lines)
@fontAwesomeEotPath: asset-url("fontawesome-webfont.eot");
@fontAwesomeEotPath_iefix: asset-url("fontawesome-webfont.eot?#iefix");
@fontAwesomeWoffPath: asset-url("fontawesome-webfont.woff");
@fontAwesomeTtfPath: asset-url("fontawesome-webfont.ttf");
@fontAwesomeSvgPath: asset-url("fontawesome-webfont.svg#fontawesomeregular");

// Font Awesome
@import "fontawesome/font-awesome";   

On the local development environment everything is ok. After deployment with Capistrano to a staging environment, the icons are not showing up in the browsers.

Instead in the server console and in the browsers network monitor an 404 error shows up for the necesarry fontawesome font files.

Started GET "/assets/fontawesome-webfont.woff"
Served asset /fontawesome-webfont.woff - 404 Not Found (2ms)
ActionController::RoutingError (No route matches [GET] "/assets/fontawesome-webfont.woff"):
cache: [GET /assets/fontawesome-webfont.ttf] miss
Started GET "/assets/fontawesome-webfont.ttf"
Served asset /fontawesome-webfont.ttf - 404 Not Found (2ms)
ActionController::RoutingError (No route matches [GET] "/assets/fontawesome-webfont.ttf"):
cache: [GET /assets/fontawesome-webfont.svg] miss
Started GET "/assets/fontawesome-webfont.svg"
Served asset /fontawesome-webfont.svg - 404 Not Found (4ms)
ActionController::RoutingError (No route matches [GET] "/assets/fontawesome-webfont.svg"):

Concerning the 404 errors, looking in the appropriate folder on the staging server

[root@j87849 assets]# ls -l
total 840
-rw-rw-r-- 1 deploy deploy 288667 21. Apr 20:01 application.css
-rw-rw-r-- 1 deploy deploy  32651 21. Apr 20:01 application.css.gz
-rw-rw-r-- 1 deploy deploy    295 21. Apr 20:01 application.js
-rw-rw-r-- 1 deploy deploy    197 21. Apr 20:01 application.js.gz
-rwxr-xr-x 1 deploy deploy  37405  5. Apr 20:18 fontawesome-webfont.eot
-rwxr-xr-x 1 deploy deploy 197829  5. Apr 20:18 fontawesome-webfont.svg
-rwxr-xr-x 1 deploy deploy  79076  5. Apr 20:18 fontawesome-webfont.ttf
-rwxr-xr-x 1 deploy deploy  43572  5. Apr 20:18 fontawesome-webfont.woff

回答1:


Update to Rails 3.2 solved the issue



来源:https://stackoverflow.com/questions/23203883/fontawesome-icons-with-twitter-bootstrap-rails-doesnt-show-on-staging-environme

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!