另一个"Foundation icons not display in Heroku Rails 4"帖子



我发现有几个线程解决了基础图标在生产环境中不显示但在开发中显示良好的问题。我遵循了其中每一个的方向和解决方案,包括尝试这个宝石,最近通过使用这篇文章没有这个宝石,但我仍然无法在生产中获得图标。

在预编译资产时,字体似乎得到了正确的指纹,但Heroku似乎找错了地方。以下是Heroku日志中的一个错误示例:

ActionController::RoutingError (No route matches [GET] "/assets/foundation-icons.ttf"):

我尝试过将其添加到我的应用程序.css.scss文件:

@import 'foundation-icons';
@font-face {
    font-family: "foundation-icons";
    src: font-url( asset-path("foundation-icons.eot") );
    src: font-url( asset-path("foundation-icons.eot?#iefix") )   format("embedded-opentype"),
     font-url( asset-path("foundation-icons.woff") ) format("woff"),
     font-url( asset-path("foundation-icons.ttf") ) format("truetype"),
     font-url( asset-path("foundation-icons.svg#fontcustom") ) format("svg");
  font-weight: normal;
  font-style: normal;
  }

我真的被这件事难住了。

当我在application.rb:中将包含图标的css目录添加到我的资产路径时,我的问题得到了解决

config.assets.paths << Rails.root.join('app/assets/stylesheets/foundation-icons')

另一种方法是在应用程序中使用*= require_directory ./foundation-icons。假设图标目录位于app/assets/stylesheets 中

最新更新