将 style.css.scss 更改为 style.css.scss.erb 时找不到文件错误
File Not Found Error When Changing style.css.scss to style.css.scss.erb
当我将 rails 应用程序部署到 Heroku 时,我一直在 让我的背景图片显示出来。我终于在 Heroku 文档中找到了这个:
In Rails 4 sprockets will only produce digest filenames. This means
that you must use an ERB helper such as this to reference your assets:
<%= asset_path('logo.png') %>
Make sure to add a .erb extension to any
files in app/assets that use an ERB helper. So application.css would
need to be application.css.erb.
我尝试将包含违规背景图片的 style.css.scss
文件重命名为 style.css.scss.erb
。这使我能够将 link 更改为有问题的背景图片:
background: <%= asset_path('bg-hero-000.jpg') %> no-repeat center center fixed;
但是,我无法判断这是否是让 Heroku 实际显示我的图像的灵丹妙药,因为我现在收到该文件的 File to import not found or unreadable:
错误。
我在这个问题上做了一些相当广泛的谷歌搜索,但似乎无法找到解决错误的方法。任何帮助或智慧都会很棒!
我以前遇到过这个问题,只能通过将我的图像文件放在 public 文件夹中才能解决。
当我将 rails 应用程序部署到 Heroku 时,我一直在
In Rails 4 sprockets will only produce digest filenames. This means that you must use an ERB helper such as this to reference your assets:
<%= asset_path('logo.png') %>
Make sure to add a .erb extension to any files in app/assets that use an ERB helper. So application.css would need to be application.css.erb.
我尝试将包含违规背景图片的 style.css.scss
文件重命名为 style.css.scss.erb
。这使我能够将 link 更改为有问题的背景图片:
background: <%= asset_path('bg-hero-000.jpg') %> no-repeat center center fixed;
但是,我无法判断这是否是让 Heroku 实际显示我的图像的灵丹妙药,因为我现在收到该文件的 File to import not found or unreadable:
错误。
我在这个问题上做了一些相当广泛的谷歌搜索,但似乎无法找到解决错误的方法。任何帮助或智慧都会很棒!
我以前遇到过这个问题,只能通过将我的图像文件放在 public 文件夹中才能解决。