Hi, i have added Highcharts library but when running Gulp --prod the highchart files are deleted from /lib/highcharts Can you please give instruction how to add js library. Should i use npm, bower, gulp, candycrush... please clarify
5 Answer(s)
-
0
Hi @rvanwoezik,
You must use npm or yarn to add client side libraries. We were using bower but it is deprecated now, so we switched to npm.
Gulp taks removes all files under lib folder and moves files from node_modules (mostly) to lib folder according to mapping on bundle.config.js file.
-
0
Thanks ismcagdas, So to make sure to add for instance highcharts I do the following steps: npm install highchart then add to bundle.config.js
"node_modules/highcharts/highcharts.js": "highcharts", "node_modules/highcharts/css/highcharts.css": "highcharts",
Then run Gulp --prod when publishing to production Is this correct?
-
0
Hi @rvanwoezik , your steps are correct. Left side is source and right side is target. Then of cource you can add js and css files references to bundle.config.js, too.
-
0
@rvanwoezik,
If you run "npm install highchart", it will not add this package to package.json, so it's better to run "npm install highchart --save".
You also need to include "~/lib/highcharts/highcharts.js" and "~/lib/highcharts/highcharts.css" into the page you use highcharts. Or you can add those files into one of the bundles in bundle.config.js.
-
0
Thanx! It's working