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

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

问题描述

我正在使用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屋!

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