build locally and push

first, build something locally

then

  • go to github.com to create a new repo
  • push to local project to that repo by:
  • Create New Repository
  • Open Terminal. Change the current working directory to your local project.

$ git init

$ git add

$ git commit -m "First commit"
$ git remote add origin remote-repository-URL

$ git remote -v
$ git push origin master

git branch gh-pages
git checkout gh-pages
git push -u origin gh-pages
git checkout master

publish

npm install -g yarn
yarn init(this create a package.json)

npm install -g gulp

yarn add gulp gulp-gh-pages gulp-load-plugins --dev
touch gulpfile.js
nano gulpfile.js

const gulp = require('gulp');
const gulpLoadPlugins = require('gulp-load-plugins');

const $ = gulpLoadPlugins();

// Publishes the site to GitHub Pages
gulp.task('publish', () => {
  console.log('Publishing to GH Pages');
  return gulp.src('./_book/**/*')
    .pipe($.ghPages({
      origin: 'origin',
      branch: 'gh-pages'
    }));
});

gulp publish