Hologram Gulp Plugin

December 9, 2014 ยท View on GitHub

/* // Usage: gulp.task('docs', function(cb) { gulp.src('path/to/your/src') .pipe(hologram(cb)); }); */

var gulp = require('gulp'), notify = require('gulp-notify'), gutil = require('gulp-util'), map = require('map-stream'), spawn = require('child_process').spawn;

/**

  • Facade/Plugin for compiling Hologram as a stream
  • @param task
  • @param taskCallback
  • @returns {*} */ module.exports = function(taskCallback) {

// (child-process.spawn implementation) return map(function(file) {

var args = [
    './path-to-your-config-here.yml'
  ],
  hologram = spawn('hologram', args, {stdio: 'inherit'});

hologram

  // Print hologram stdout to log.
  .on('data', function(data) {
    gutil.log(data.toString().trim());
  })

  // Handle end of command execution.
  .on('close', function(code) {
    var error;
    if (code && 0 !== code) {
      error = new gutil.PluginError('hologram', 'Hologram failed with error code: ' + code);
    }
    taskCallback(error, file);
  });

});

};