Переглянути джерело

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({
+    clean: {
+      docs: ['docs/_site']
+    },
+
     uglify: {
       'dist': {
         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: {
       options: {
         src: 'docs',
@@ -192,6 +207,7 @@ module.exports = function (grunt) {
     }
   });
 
+  grunt.loadNpmTasks('grunt-contrib-clean');
   grunt.loadNpmTasks('grunt-contrib-concat');
   grunt.loadNpmTasks('grunt-contrib-jshint');
   grunt.loadNpmTasks('grunt-contrib-qunit');
@@ -199,6 +215,7 @@ module.exports = function (grunt) {
   grunt.loadNpmTasks('grunt-contrib-uglify');
   grunt.loadNpmTasks('grunt-contrib-watch');
 
+  grunt.loadNpmTasks('grunt-gh-pages');
   grunt.loadNpmTasks('grunt-jekyll');
   grunt.loadNpmTasks('grunt-sass');
 
@@ -210,5 +227,5 @@ module.exports = function (grunt) {
 
   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": {
     "grunt": "^0.4.5",
     "grunt-cli": "^0.1.13",
+    "grunt-contrib-clean": "^0.6.0",
     "grunt-contrib-concat": "^0.4.0",
     "grunt-contrib-jshint": "^0.10.0",
     "grunt-contrib-nodeunit": "~0.3.3",
@@ -40,6 +41,7 @@
     "grunt-contrib-requirejs": "^0.4.4",
     "grunt-contrib-uglify": "~0.4.0",
     "grunt-contrib-watch": "~0.6.0",
+    "grunt-gh-pages": "^0.9.1",
     "grunt-sass": "~0.12.0",
     "node-sass": "~0.8.6"
   }