template/publish.js
function write(relPath, data, cb) {
  var target = path.join(context.destination, relPath);

  mkdirp(path.dirname(target), handleErrorCallback(function() {
    fs.writeFileSync(target, data);
    handleErrorCallback(cb)(null, target);
    logger.debug('file written: %s', target);
  }));
}
function write(relPath, data, cb) {
  var target = path.join(context.destination, relPath);

  mkdirp(path.dirname(target), handleErrorCallback(function() {
    fs.writeFileSync(target, data);
    handleErrorCallback(cb)(null, target);
    logger.debug('file written: %s', target);
  }));
}
function write ( relPath , data , cb ) { var target = path . join ( context . destination , relPath ) ; mkdirp ( path . dirname ( target ) , handleErrorCallback ( function ( ) { fs . writeFileSync ( target , data ) ; handleErrorCallback ( cb ) ( null , target ) ; logger . debug ( 'file written: %s' , target ) ; } ) ) ; }
Handle all write operations.

@private
@param {string}   relPath Relative path in the ouput directory
@param {string}   data    File content
@param {publish.writeCallback} cb node fs.write compatible callback
@return {undefined}
Handle all write operations .