【问题标题】:Application Layout Stylesheet Include Can't Find Image Asset Using Wicked PDF Using Bootstrap应用程序布局样式表包含无法使用 Wicked PDF 使用 Bootstrap 找到图像资产
【发布时间】:2021-04-20 12:50:25
【问题描述】:

我的 Rails 6 应用正在使用 webpack 和 yarn。我仍然为我的 sass 样式表使用资产管道。我正在为我使用 Wicked PDF 生成的 PDF 使用布局 css 样式表。我在生产中收到以下错误,但在开发中没有出现(因为根据最佳实践,配置设置回退到资产管道在生产中是错误的):

ActionView::Template::Error (The asset "%22images%2Fui-icons_555555_256x240.png%22" is not present in the asset pipeline.

--

<!-- application.pdf.erb, used as my layout for PDFs -->
  <head>
    <meta charset='utf-8' />
    <%= wicked_pdf_stylesheet_link_tag "application" %> <!-- this one is problematic -->
    <%= wicked_pdf_stylesheet_link_tag "application_pdf" %>
  </head>

<!-- application.scss , line of the error -->>
...
@import "bootstrap/scss/bootstrap" // imported from node_modules, installed with yarn, using webpack
...

为什么我找不到 ui-icons 图片资源?我在这里做错了什么?

【问题讨论】:

    标签: ruby-on-rails sass wicked-pdf


    【解决方案1】:

    原来是一些 Jquery UI 样式表导入导致了问题。他们通过添加引用图像的代码来做一些时髦的事情。一旦我删除了 JQuery UI 导入,一切都运行良好。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-02-17
      • 1970-01-01
      • 2017-02-16
      • 1970-01-01
      • 1970-01-01
      • 2015-06-02
      • 2018-11-16
      • 2015-11-12
      相关资源
      最近更新 更多