瀏覽代碼

Set up the GitHub Pages command

Now we can synchronize GitHub Pages with the docs in the master
branch quickly and easily.
Kevin Brown 10 年之前
父節點
當前提交
12de3c2b5e
共有 2 個文件被更改,包括 20 次插入1 次删除
  1. 18 1
      Gruntfile.js
  2. 2 0
      package.json

+ 18 - 1
Gruntfile.js

@@ -32,6 +32,10 @@ module.exports = function (grunt) {
   }
   }
 
 
   grunt.initConfig({
   grunt.initConfig({
+    clean: {
+      docs: ['docs/_site']
+    },
+
     uglify: {
     uglify: {
       'dist': {
       'dist': {
         src: 'dist/js/select2.js',
         src: 'dist/js/select2.js',
@@ -49,6 +53,17 @@ module.exports = function (grunt) {
       ]
       ]
     },
     },
 
 
+    'gh-pages': {
+      options: {
+        base: 'docs',
+        clone: 'node_modules/grunt-gh-pages/repo',
+        message: 'Updated docs with master',
+        push: false,
+        repo: '[email protected]:kevin-brown/select2.git'
+      },
+      src: '**'
+    },
+
     jekyll: {
     jekyll: {
       options: {
       options: {
         src: 'docs',
         src: 'docs',
@@ -192,6 +207,7 @@ module.exports = function (grunt) {
     }
     }
   });
   });
 
 
+  grunt.loadNpmTasks('grunt-contrib-clean');
   grunt.loadNpmTasks('grunt-contrib-concat');
   grunt.loadNpmTasks('grunt-contrib-concat');
   grunt.loadNpmTasks('grunt-contrib-jshint');
   grunt.loadNpmTasks('grunt-contrib-jshint');
   grunt.loadNpmTasks('grunt-contrib-qunit');
   grunt.loadNpmTasks('grunt-contrib-qunit');
@@ -199,6 +215,7 @@ module.exports = function (grunt) {
   grunt.loadNpmTasks('grunt-contrib-uglify');
   grunt.loadNpmTasks('grunt-contrib-uglify');
   grunt.loadNpmTasks('grunt-contrib-watch');
   grunt.loadNpmTasks('grunt-contrib-watch');
 
 
+  grunt.loadNpmTasks('grunt-gh-pages');
   grunt.loadNpmTasks('grunt-jekyll');
   grunt.loadNpmTasks('grunt-jekyll');
   grunt.loadNpmTasks('grunt-sass');
   grunt.loadNpmTasks('grunt-sass');
 
 
@@ -210,5 +227,5 @@ module.exports = function (grunt) {
 
 
   grunt.registerTask('docs', ['jekyll:serve']);
   grunt.registerTask('docs', ['jekyll:serve']);
 
 
-  grunt.registerTask('release', ['default', 'jekyll:build']);
+  grunt.registerTask('release', ['default', 'clean:docs', 'gh-pages']);
 };
 };

+ 2 - 0
package.json

@@ -33,6 +33,7 @@
   "devDependencies": {
   "devDependencies": {
     "grunt": "^0.4.5",
     "grunt": "^0.4.5",
     "grunt-cli": "^0.1.13",
     "grunt-cli": "^0.1.13",
+    "grunt-contrib-clean": "^0.6.0",
     "grunt-contrib-concat": "^0.4.0",
     "grunt-contrib-concat": "^0.4.0",
     "grunt-contrib-jshint": "^0.10.0",
     "grunt-contrib-jshint": "^0.10.0",
     "grunt-contrib-nodeunit": "~0.3.3",
     "grunt-contrib-nodeunit": "~0.3.3",
@@ -40,6 +41,7 @@
     "grunt-contrib-requirejs": "^0.4.4",
     "grunt-contrib-requirejs": "^0.4.4",
     "grunt-contrib-uglify": "~0.4.0",
     "grunt-contrib-uglify": "~0.4.0",
     "grunt-contrib-watch": "~0.6.0",
     "grunt-contrib-watch": "~0.6.0",
+    "grunt-gh-pages": "^0.9.1",
     "grunt-sass": "~0.12.0",
     "grunt-sass": "~0.12.0",
     "node-sass": "~0.8.6"
     "node-sass": "~0.8.6"
   }
   }