【问题标题】:Rails & themeforest integration issue, getting routing errorRails 和主题森林集成问题,出现路由错误
【发布时间】:2019-07-15 00:45:17
【问题描述】:

我正在尝试将主题森林模板集成到 Rails 应用程序中。我收到路由错误

ActionController::RoutingError (没有路由匹配 [GET] "/assets/fonts/fontawesome-webfont.woff"):

我实际上遵循了Themeforest to Rails App中给出的解决方案

结构如下

-assets - fonts - images - javascripts - stylesheets

我的 font-awesome.css 文件有

@font-face { font-family: 'FontAwesome'; src: url('fonts/fontawesome-webfont.eot?v=4.2.0'); src: url('fonts/fontawesome-webfont.eot?#iefix&v=4.2.0') format('embedded-opentype'), url('fonts/fontawesome-webfont.woff?v=4.2.0') format('woff'), url('fonts/fontawesome-webfont.ttf?v=4.2.0') format('truetype'), url('fonts/fontawesome-webfont.svg?v=4.2.0#fontawesomeregular') format('svg'); font-weight: normal; font-style: normal; }

我哪里错了?

【问题讨论】:

  • 不确定 - 但我从代码和错误中看到您的 CSS 文件正在从名为 fonts/fontawesome-webfont 的文件中获取字体样式,但您的项目中没有这样的文件?您可能需要下载并将它们放在 assets/fonts 目录下

标签: ruby-on-rails ruby-on-rails-5 themes


【解决方案1】:

我认为问题在于你如何使用路径,你可以将其更改为

@font-face {
    font-family: 'FontAwesome';
    src: asset-url('fontawesome-webfont.eot');
    src: asset-url('fontawesome-webfont.eot') format('embedded-opentype'),
           asset-url('fontawesome-webfont.woff') format('woff'),
           asset-url('fontawesome-webfont.ttf') format('truetype'),
           asset-url('fontawesome-webfont.svg#fontawesomeregular') format('svg');
    font-weight: normal;
    font-style: normal;
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-31
    • 1970-01-01
    • 2011-06-16
    相关资源
    最近更新 更多