Highcharts在Heroku上不起作用 [英] Highcharts doesn't work on Heroku
问题描述
在本地,它就像一个魅力,然而当我将应用程序推到Heroku时,Highcharts停止工作,应该包含图表的 div
标签显示为空。
我甚至用Highcharts的一个例子(它只有硬编码的数据)对它进行了测试,但仍然没有任何结果。
发现:问题在于预编译资产。原来,highcharts并没有预编译。
新增:
config.assets.precompile + = ['rollover。 js','highcharts.js']
到production.rb(我想application.rb应该也可以)
和
到布局文件。
(因为我预计所有的javascript文件都会被编译到application.jss中只有<%= javascript_include_tag应用程序%>在我的布局文件中)
I have a ruby on rails app that uses highcharts.
Locally it works like a charm, however when I push the app to Heroku, Highcharts stops working and the div
tag that is supposed to contain the chart appears empty.
I even tested it with one of the Highcharts examples (which has only hardcoded data), and still nothing.
Figured it out: The problem was in the precompiling of assets. Turned out that highcharts was not precompiled
Added :
config.assets.precompile += ['rollover.js', 'highcharts.js'] to production.rb (i suppose application.rb should work as well)
and
to layout file.
(since i expected all javascript files gets compiled in application.jss i only had <%= javascript_include_tag "application" %> in my layout file)
这篇关于Highcharts在Heroku上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!