How to include highcharts with bower?

2019-02-21 13:24发布

I would like to use highcharts. I did bower install highcharts.com (highcharts recommends using highcharts.com.

However, I have no idea what to include in my html file. I am guessing bower_components/highcharts.com/js/highcharts.src.js. But this is a huge file, and it will slow the build process if I minify it every build...

How should I include highcharts with bower ?

3条回答
爷的心禁止访问
2楼-- · 2019-02-21 13:45

I ran into the same problem you can do the following for highcharts

bower install highcharts-release

and to get highstock you can do this

bower install highstock-release

and you would include one of the following

'/bower_components/highcharts-release/highcharts.js'
'/bower_components/highstock-release/highstock.js'
查看更多
beautiful°
3楼-- · 2019-02-21 13:52

As Erik mentioned, use the release version of Highcharts JS:

https://github.com/highslide-software/highcharts-release

If you're using grunt, simply run grunt bower-install and it will install the dependencies into your project.

Otherwise, include the javascript files that are part of the package:

bower_components/highcharts-release/highcharts.js
bower_components/highcharts-release/highcharts-more.js

and if you plan on exporting:

bower_components/highcharts-release/modules/exporting.src.js
查看更多
Animai°情兽
4楼-- · 2019-02-21 13:59

Try the release version: https://github.com/highslide-software/highcharts-release.

This is the official shim repo for Highcharts JS releases including minified files. It is optimized for inclusion by Bower.

查看更多
登录 后发表回答