如何在Rails 3.2中添加Favicon [英] How to add favicon in rails 3.2
问题描述
我知道新的Rails应用程序带有一个空的favicon.ico文件.我想知道如何添加收藏夹图标.我知道您可以使用favicon_link_tag
帮助器,但是我不确定如何填充favicon.ico文件.您是否使用网站图标生成器?如果是这样,哪个最好?
I know new rails apps come with an empty favicon.ico file. I want to know how I go about adding a favicon. I know you can use the favicon_link_tag
helper, but I am not sure how to populate the favicon.ico file. Do you use favicon generators? If so, which one is best?
我还希望能够对其进行缓存,rails也会自动进行缓存吗?
I also want to be able to cache it, does rails do that automatically as well?
谢谢
推荐答案
例如在以下位置生成您的网站图标: http://www.favicon.cc / 并放入public/目录
generate your favicon for example here: http://www.favicon.cc/ and put in to public/ directory
更新 公用文件夹中的Favicon未预先编译,因此可能会缓存很长时间. 似乎最好使用 favicon_link_tag 以避免出现favicon更新问题.我不知道浏览器在根目录中需要favicon.根据 favicon Wiki ,所有现代浏览器都维护
UPDATE Favicon in public folder is not precompiled and it may be cached for a long time. It looks like it is better to use favicon_link_tag to avoid favicon updating problems. I do not know browsers needed favicon in root. According to favicon wiki all modern browsers maintains
<link rel="shortcut icon" href="favicon path" /> (favicon_link_tag)
这篇关于如何在Rails 3.2中添加Favicon的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!