本文介绍了资产"logo.png"在资产管道中不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Rails 5.1.3中我在应用程序/资产/图像中更改徽标文件然后错误不知道要解决什么.有人知道吗?

In Rails 5.1.3I change logo file in app/assets/imagesThen error don't know what to fix. Any one know ?

The asset "logo.png" is not present in the asset pipeline.

已经尝试重新启动rails,rails clean,rails或rails asset:precompile

Already try restart rails, rails clean, rails or rails assets:precompile

这是我的config/initializers/assets.rb

Here my config/initializers/assets.rb

# Be sure to restart your server when you modify this file.

# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0'

# Add additional assets to the asset load path.
# Rails.application.config.assets.paths << Emoji.images_path
# Add Yarn node_modules folder to the asset load path.
Rails.application.config.assets.paths << Rails.root.join('node_modules')

# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in the app/assets
# folder are already added.
# Rails.application.config.assets.precompile += %w( admin.js admin.css )

推荐答案

我遇到了类似的问题.解决方案是在图像上添加文件扩展名.

I had a similar problem. The solution was to add the file extension on the image.

= image_tag 'logo', alt: ''

= image_tag 'logo.jpg', alt: ''

这篇关于资产"logo.png"在资产管道中不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 05:24