Javascript 功能在本地主机上工作,但在部署到 Heroku 时不起作用 [英] Javascript features work on localhost but not when deployed to Heroku

查看:32
本文介绍了Javascript 功能在本地主机上工作,但在部署到 Heroku 时不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到当我部署到 Heroku 时,javascript 功能不起作用(例如 Bootstrap Popover、按钮等).我正在使用 rails 3.2.2,ruby 1.9.3.这些功能适用于本地主机.部署到 Heroku 时似乎没有显示任何错误(这些功能根本不显示).

I've noticed that when I deploy to Heroku, javascript features dont work (such as Bootstrap Popover, Buttons, etc). I'm working with rails 3.2.2, ruby 1.9.3. The features work on localhost. There appear to be no errors displayed when deployed to Heroku (the features simply don't show up).

有什么想法吗?谢谢!

推荐答案

我也遇到了类似的问题,但问题也发生在 localhost 上.

I also had similar problem but the problem was happening on localhost as well.

您可能正在使用 rails-bootstrap gem.它安装了一个文件 bootstrap.coffee.js 这个文件是罪魁祸首.它使用了 .popover 并且不包含相关插件.我将其注释掉了,因为我无论如何都没有使用它,但您应该考虑为 bootstrap 包含 popover 插件.

You are probably using rails-bootstrap gem. It installs a file bootstrap.coffee.js This file was culprit. It had .popover use and relevant plugin was not included. I commented that out as I was not using it anyway but you should consider including the popover plugin for bootstrap.

这篇关于Javascript 功能在本地主机上工作,但在部署到 Heroku 时不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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