rails 4资产管道供应商资产图像未预先编译 [英] rails 4 asset pipeline vendor assets images are not being precompiled
问题描述
我正在使用Rails 4&我的应用程序和fancybox2-rails
gem的ruby 1.9.3,但是资产管道存在一个普遍的问题.如果我运行rake task
进行预编译,那么除了vendor/assets/images
和../gems/ruby-1.9.3-p327/gems/fancybox2-rails-0.2.1/vendor/assets/images
中的图像,一切都很好.这两个文件夹中的图像未进行预编译,最终我遇到了指向不存在的图像的无效链接的问题.有什么建议吗?
I'm using rails 4 & ruby 1.9.3 for my application and fancybox2-rails
gem, but there's a general problem with asset pipeline. If I run rake task
for precompile, then everything is fine except for images in vendor/assets/images
and ../gems/ruby-1.9.3-p327/gems/fancybox2-rails-0.2.1/vendor/assets/images
. Images from these two folders are not being precompiled and eventually I have a problem with dead links to non-existing images. Any suggestions?
推荐答案
似乎默认情况下仅从app/assets文件夹包含图像.所以解决方案是将这一行添加到config/application.rb
It seems like images are included by default only from app/assets folder. So the solution is to add this line to config/application.rb
config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif)
这篇关于rails 4资产管道供应商资产图像未预先编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!