邪恶的pdf在生产中找不到我的资产

问题描述 投票:2回答:1

我的wicked pdf CSS出现问题,所有问题都在本地运行,但在生产中找不到pdf.css

ActionView::Template::Error (The asset "components/pdf.css" is not present in the asset pipeline.):
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
<%= wicked_pdf_stylesheet_link_tag 'components/pdf.css' %>
 </head>
<body>
<%= yield %>

我的pdf.html.erb

<!doctype html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
    <%= wicked_pdf_stylesheet_link_tag 'components/pdf' %>
  </head>
  <body>
      <%= yield %>
  </body>
</html>

我的组件/pdf.css

.document-pdf {
  background-image: asset-data-url("fond.png");
  background-size: 23cm 13cm;
  background-color: white;
  background-repeat: no-repeat;
  background-position: 50% 70%;
  font-family: "Helvetica Neue", Helvetica;
}
css ruby-on-rails ruby wicked-pdf
1个回答
3
投票

您是否已将pdf.css添加到initializers/assets.rb预编译资产中?

Rails.application.config.assets.precompile += ['pdf.css']
© www.soinside.com 2019 - 2024. All rights reserved.