Pattern Library Utilities

ghPages

declaration
ghPages

@fileOverview Uses Gulpjs to publish code to gh-pages

@author Scott Nath

@requires NPM:gulp-gh-pages
@requires ./lib/get-options

var ghPages = require('gulp-gh-pages');
var mergeOptions = require('../get-options').mergeOptions;

getDefaultOptions

function
getDefaultOptions()

Function to get default options for an implementation of a gulp-gh-pages task

var getDefaultOptions = function () {
  'use strict';

  // default options for ghPages gulp task
  var options = {
    config: {},
    src: ['./patternlab/public/'],
    taskName: 'ghPages',
    dependencies: [] // gulp tasks which should be run before this task

  };

  return options;
};

gulpGhPages

method
exports.gulpGhPages()

@param Type Description
gulp Object including file should inject the gulp module
projectOptions Object object of options

Gulp task that sends files to the gh-pages branch on github.com

exports.gulpGhPages = function (gulp, projectOptions) {
  'use strict';
  var options = mergeOptions(getDefaultOptions(), projectOptions);

  gulp.task(options.taskName, options.dependencies, function () {
    return gulp.src(options.src)
      .pipe(ghPages(options.config));
  });
};