Gem 请教 social-share-button

benyu · 2014年07月30日 · 最后由 benyu 回复于 2014年07月31日 · 2518 次阅读

@huacnlee 按 github 上的说明完成 social-share-button 的安装和使用,在开发模式(rails s) 一切正常,为什么放到 nginx+Passenger 后前面的小图标就无法显示?运行 RAILS_ENV=production rails assets:clean/precompile 也没有? 谢谢!

你的小图标放在哪里的? app/assets/images?如果不是,就要加到config.assets.precompile配置里边。

#1 楼 @Martin91 啊,还要自己去哪下载小图标呢?谢谢

#2 楼 @benyu 不是下载啊,你与 social-share-button 的代码是怎么组织的

#3 楼 @Martin91 完全按 GITHUB 上面说的, 加 gem 'social-share-button'到 Gemfile 安装 bundle install 加入//= require social-share-button 到 application.js 加 *= require social-share-button 到 application.css 页面<%= social_share_button_tag(target.title, :image = ''%>输出啊!

是不是有什么漏了或不正确的吗?

#4 楼 @benyu 是不是要把sprites/social-share-button.png这个文件加到 precompile 啊?

未解! 谢谢 @Martin91

Nginx 配置看看 其他图片能显示么

@huacnlee ,终于出来,请的就是你,谢谢! nginx 如果有问题,我想同个 assets 下的图片或文件也不显示对吧?但其它可以!

主要自己添加的就这些 location / { passenger_enabled on; rails_env production; index index.html index.htm; }

没有用 Nginx 做缓存之类的 (在本机只是把 env 换成 production)!所以不得其解!

#8 楼 @huacnlee 刚才注意到有个小问题,分享到花瓣的图标不会显示 (缺少 css 定义的样子),同时它的 i18n 是不是少了?

需要 登录 后方可回复, 如果你还没有账号请 注册新账号