Reputation: 88367
If I am using GitHub pages for my personal site, how should manage my source files? I have a simple setup which works.
But I understand I can't using Jekyll plugins with GitHub pages. If I want to use Grunt for example to optimise my images, for a usual app/site, it will produce output in say a dist/public
folder, which I will then deploy. But I want to still use GitHub to manage my source files, how should I do it?
Upvotes: 3
Views: 1153
Reputation: 52829
Depending of repository kind your using, a User/Organization (UO) site or a Project site (P), sources and pages will be versionned in :
Note: The pages branch is mandatory, but the sources branch name can be changed.
Locally, initialize your local repository :
cd /home/username/www/yoursite
or anything you wantgit remote add origin [email protected]:userName/userName.github.io.git
(UO) or git remote add origin [email protected]:userName/repositoryName.git
(P)git checkout -b sources
(UO) or git checkout master
(P)dist/public
. As you are currently on master
we will ignore it an version it in an other branchgit push origin sources
(UO) or git push origin master
(P) push your sources in the appropriate branchcd dist/public
touch .nojekyll
, this file tells gh-pages that there is no need to build a Jekyll sitegit init
git remote add origin [email protected]:userName/userName.github.io.git
(UO) or git remote add origin [email protected]:userName/repositoryName.git
(P)git checkout master
(UO) or git checkout -b gh-pages
(P) put this repository on the appropriate branchgrunt
task heregit add -A
git commit -m "first build"
commit your site codegit push origin master
(UO) or git push origin gh-pages
(P)You now have pushed your code and pages in two different branches. They will now be pushed depending on where you are :
cd yourWorkingDirestory
git add -A
git commit -m "your commit message"
git push origin sources
(UO) or git push origin master
(P)cd yourWorkingDirestory/dist/public
git add -A
git commit -m "your commit message"
git push origin master
(UO) or git push origin gh-pages
(P)Upvotes: 5