Dokku 部署 Rails 站点不重写 SCSS 图像

Dokku deployed Rails site does not rewrite SCSS images

我正在使用 Dokku 部署 RoR 站点,使用 Herokuish Ruby buildpack

我部署的时候没有报错:(虽然时间确实很短)

-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       Asset precompilation completed (3.58s)
       Cleaning assets

资产文件名已正确识别指纹,视图中使用的图像已按预期重写路径。

然而,尽管我在 SCSS 中使用了 background-image: url(image_path('parallax/masthead.jpg'));,但并未重写 URL。

这是我的 config/production.rb

中的相关行
config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
config.assets.js_compressor = :uglifier
config.assets.compile = false
config.assets.digest = true

在我的 Gemfile 中有:

group :production do
  gem 'puma', '~> 2.15.3'
  gem 'rails_12factor'
end

我在本地尝试了 运行 rake assets:precompile RAILS_ENV=production 并且成功了,视图和 CSS 都被正确重写了。

尝试将 background-image: url(image_path('parallax/masthead.jpg')); 重写为

background-image: image-url('parallax/masthead.jpg');

啊,我找到了 - 在我的 SCSS 文件中:

background: url(image_path('layout/opacity.png')) repeat; 

由于某种原因导致它失败。将其更改为:

background-image: url(image_path('layout/opacity.png'));
background-repeat: repeat;

已排序。