7
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

特定のディレクトリだけをGitHub Pagesにデプロイするためにgulpを使う

Posted at

発見

その名のとおりgulp-gh-pagesという便利なプラグインがあった。

インストール

npm でインストールする。

npm install --save-dev gulp-gh-pages

タスクの定義

公式サイトのとおり、以下のようなタスクを定義する。

gulpfile.js
var gulp = require('gulp');
var ghPages = require('gulp-gh-pages');

gulp.task('deploy', function() {
  return gulp.src('./app/**/*')
    .pipe(ghPages());
});

実行

あとはgulp deployで実行だ。

[20:58:45] Using gulpfile C:\projects\qqiq-fan-site\gulpfile.js
[20:58:45] Starting 'deploy'...
[20:58:47] [gh-pages] Cloning repo
[20:58:47] [gh-pages] Checkout branch `gh-pages`
[20:58:48] [gh-pages] Updating repository
[20:58:55] [gh-pages] Copying files to repository

こんな感じで自動的にチェックアウトしてコミットしてプッシュまでしてくれる。

7
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?