Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Github Pages with Dependencies?

Sorry if this is more of a general question.

I set up a github pages account under: username.github.io

This allows me to access my applications on: username.github.io/repository-name

Now I am wondering, how do you guys handle the dependency problem, since your application probably requires node_modules, bower_components or other dependencies?

In my understanding you don't want to have dependencies in your repository, because repositories become unnecessarily bloated. We invented .gitignore for that.

But your SPAs won't work without them.

Do you just create a gh-pages branch with all dependencies and push it with dependencies?

How do you handle switching branches on your local machine then, since switching branches from master to gh-pages and back to master will result in your dependencies missing in master and require you to npm install and bower install every single time?

like image 585
LoveAndHappiness Avatar asked Nov 24 '15 06:11

LoveAndHappiness


Video Answer


1 Answers

You can consider your gh-pages branch more as a server than as a git branch - so many of the common rules for git branches don't apply there.

It's not uncommon, if you are developing an application hosted on GH:Pages, that your gh-pages branch is full of auto-generated content - exactly the opposite of what you'd do on a normal git branch, in which you don't version generated resources.

So it wouldn't be uncommon to have some build process that generates the contents of the gh-pages branch. You can learn a bit about how Learn Git Branching does the trick, for example, or read the Jekyll on GitHub Pages docs to get a better insight.

like image 131
mgarciaisaia Avatar answered Oct 10 '22 17:10

mgarciaisaia