javascript 如何在 bower 中包含 highcharts?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21042458/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 19:53:45  来源:igfitidea点击:

How to include highcharts with bower?

javascripthighchartsbower

提问by Benjamin Crouzier

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

我想使用highcharts。我做到了bower install highcharts.comhighcharts建议使用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...

但是,我不知道要在我的 html 文件中包含什么。我猜bower_components/highcharts.com/js/highcharts.src.js。但这是一个巨大的文件,如果我每次构建都缩小它会减慢构建过程......

How should I include highcharts with bower ?

我应该如何在 bower 中包含 highcharts ?

回答by Chad Scira

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

我遇到了同样的问题,您可以对 highcharts 执行以下操作

bower install highcharts-release

凉亭安装 highcharts-release

and to get highstock you can do this

为了获得高库存,你可以这样做

bower install highstock-release

凉亭安装 highstock-release

and you would include one of the following

并且您将包括以下内容之一

'/bower_components/highcharts-release/highcharts.js'
'/bower_components/highstock-release/highstock.js'

回答by grant

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

正如 Erik 所提到的,使用 Highcharts JS 的发行版:

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

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.

如果您使用 grunt,只需运行 grunt bower-install,它就会将依赖项安装到您的项目中。

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

否则,包括作为包一部分的 javascript 文件:

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

回答by Erik

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

尝试发布版本: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.

这是 Highcharts JS 版本的官方 shim 存储库,包括缩小的文件。它针对 Bower 的包含进行了优化。