Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Best practice to add 3rd vendor #4369


User avatar
0
rvanwoezik created

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)
  • User Avatar
    0
    ismcagdas created
    Support Team

    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.

  • User Avatar
    0
    rvanwoezik created

    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?

  • User Avatar
    0
    alirizaadiyahsi created

    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.

  • User Avatar
    0
    ismcagdas created
    Support Team

    @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.

  • User Avatar
    0
    rvanwoezik created

    Thanx! It's working