html5 boilerplate: how to add third-party js?

481 Views Asked by At

I am not a web developer, and though I believe this question must have a simple answer, I couldn't find it in the documentation, nor online.

I'll use html5 boilerplate to create a very simple app.

I would like to run

npm install an-arbitrary-js-library --save
gulp build

and be able to

import a_random_function from 'an-arbitrary-js-library'

in my js/main.js file.

How can I adapt my HTML5 Boilerplate to add third-party JS libraries to my project automatically?

1

There are 1 best solutions below

2
mohessaid On

Just put a script tag with the source referring to your library in the index.html file. I don't know how you orginzed the project but you can copy the file of your third library from node_module to the project js/vendor or any other folders using gulp see from line 69 --> 95 here, this is the way they set jQuery in the project.