var Pagemaki = require("pagemaki");
var Buffer = require("buffer").Buffer;
var through = require("through");

/**
 * Returns a file handling function that can 
 * be piped to from within a gulp workflow
 * 
 * @return {[type]} [description]
 */
module.exports = function (options) {

  var maker = new Pagemaki(options);

  function write(file) {

    var stream = this;

    maker.make(file._contents.toString(), function (err, made) {
      file._contents = new Buffer(made);
      stream.queue(file);
    });
    
  }

  return through(write);

};
var Pagemaki = require("pagemaki");
var Buffer = require("buffer").Buffer;
var through = require("through");

/**
 * Returns a file handling function that can 
 * be piped to from within a gulp workflow
 * 
 * @return {[type]} [description]
 */
module.exports = function (options) {

  var maker = new Pagemaki(options);

  function write(file) {

    var stream = this;

    if (!file._contents) {
      return;
    }

    maker.make(file._contents.toString(), function (err, made) {
      file._contents = new Buffer(made);
      stream.queue(file);
    });
    
  }

  return through(write);

};
Add early return for files without _contents
Add early return for files without _contents

Errors occurred if a file was streamed through that did not have a
_contents value, so we are now exiting the function altogether if
that case fails. In the future we may want to find out what kinds
of objects are being streamed through that don't have content?
