我想将highstock(highstock.js在highcharts中)集成到我的jHipster项目中。因此我将以下内容添加到我的bower.json中:
"dependencies": {
"highcharts" : "4.2.6",
"highcharts-ng": "0.0.12"
},
"overrides": {
"highcharts-ng": {
"dependencies": {
"angular": "1.5.8",
"highcharts": "4.2.6"
}
}
}
当我使用此配置构建项目时,gulp会在index.html文件中导入javascript依赖项,如下所示:
<script src="bower_components/highcharts/highcharts.js"></script>
<script src="bower_components/highcharts/highcharts-more.js"></script>
<script src="bower_components/highcharts/modules/exporting.js"></script>
<script src="bower_components/highcharts-ng/dist/highcharts-ng.js"></script>
但我实际需要的只是highstock.js: Highcharts project overview
我如何控制,在这里导入什么?
答案 0 :(得分:1)
解决方案在于使用的gulp插件“main-bower-files”,由jHipster使用并记录here。
gulp构建脚本根据highcharts / bower.json文件决定它导入的内容。在highcharts的情况下,指定以下内容:
{
"name": "highcharts",
"version": "v4.2.6",
"main": [
"highcharts.js",
"highcharts-more.js",
"modules/exporting.js"
]
}
如果你想覆盖这个,你可以在“overrieds”部分的bower.json项目中这样做,并指定它应导入哪个javascript:
"dependencies": {
"highcharts" : "4.2.6",
"highcharts-ng": "0.0.12"
},
"overrides": {
"highcharts": {
"main": "highstock.js"
},
"highcharts-ng": {
"dependencies": {
"angular": "1.5.8",
"highcharts": "4.2.6"
}
}
}