Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Deploying to GitHub Pages

Deploying to GitHub Pages

Deploying your app using git subtree allows the use of GitHub Pages. Your gh-pages branch will contain the files from dist.

Steps

Prerequisites

  1. If not already available, install git-subtree.
  2. Ensure your generated app is in a GitHub-hosted repository that is set as your origin remote.

You can check your remotes with $ git remote -v. See Adding a remote for more info.

1. Install gulp-subtree

$ npm install --save-dev gulp-subtree

2. Create a deploy task

This will run the build task, then push it to the gh-pages branch:

gulp.task('deploy', ['build'], () => {
  return gulp.src('dist')
    .pipe($.subtree())
    .pipe($.clean());
});

3. Remove dist from .gitignore

 node_modules
-dist
 .tmp
 .sass-cache
 bower_components
 test/bower_components

Usage

  1. Run $ gulp deploy.
  2. Visit http://[your-username].github.io/[repo-name].

It might take a couple of minutes for your page to show up the first time you push to gh-pages. In the future, changes will show up instantly.

References

@webcaetano

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.