rails 4 资产管道供应商资产图像没有被预编译 [英] rails 4 asset pipeline vendor assets images are not being precompiled

查看:32
本文介绍了rails 4 资产管道供应商资产图像没有被预编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 rails 4 &ruby 1.9.3 用于我的应用程序和 fancybox2-rails gem,但是资产管道存在一个普遍问题.如果我运行 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆