Skip to content

Instantly share code, notes, and snippets.

@webcaetano
Created December 3, 2015 16:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webcaetano/37c9fd256852282df46f to your computer and use it in GitHub Desktop.
Save webcaetano/37c9fd256852282df46f to your computer and use it in GitHub Desktop.
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
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment