How to use node_modules on Github pages, without uploading to repo

I am hosting a site on Github pages and using Jekyll to build it.

I added Angular and Lodash to my project using npm

but didn't want to upload 200 odd files to GitHub, so I added node_modules

to my .gitignore

file and just made sure they were added as dependencies internally package.json

. Then the problem arises that the GitHub / Jekyll pages do not automatically install packages when (Jekyll) is generated.

So my question is, how can I use NPM on GitHub pages without actually uploading my node_modules folder to my GitHub repository?

+4


source to share


2 answers


You have two options:

create a local site

Just build your static files locally and then upload the latest site to the Github pages (Github may host non Jekyll websites)



use CI

Implement a script that after uploading your files to the master branch (like Travies) it creates your site and pushes the changes to the gp-pages branch.

+1


source


According to GitHub, you can add a _config.yml file to tell Jekyll to "include" the "node_modules" and "vendors" directories.



See: https://help.github.com/en/articles/configuring-jekyll

0


source







All Articles