index.js
function getLayout(layout) {
    if (!layoutCache.hasOwnProperty(layout)) {
      var layoutContents = false,
          layoutPath = path.join(
        path.isAbsolute(options.layoutPath) ?
          options.layoutPath : path.join(process.cwd(), options.layoutPath),
        layout
      );
      try {
        layoutContents = fs.readFileSync(layoutPath, 'utf8');
      } catch (err) {
        throw new PluginError(logFlag, 'Could not read layout: \'' + layoutPath + '\'\n');
      }
      layoutCache[layout] = {
        contents: layoutContents,
        path: layoutPath
      };
    }
    return layoutCache[layout];
  }
function getLayout(layout) {
    if (!layoutCache.hasOwnProperty(layout)) {
      var layoutContents = false,
          layoutPath = path.join(
        path.isAbsolute(options.layoutPath) ?
          options.layoutPath : path.join(process.cwd(), options.layoutPath),
        layout
      );
      try {
        layoutContents = fs.readFileSync(layoutPath, 'utf8');
      } catch (err) {
        throw new PluginError(logFlag, 'Could not read layout: \'' + layoutPath + '\'\n');
      }
      layoutCache[layout] = {
        contents: layoutContents,
        path: layoutPath
      };
    }
    return layoutCache[layout];
  }
function getLayout ( layout ) { if ( ! layoutCache . hasOwnProperty ( layout ) ) { var layoutContents = false , layoutPath = path . join ( path . isAbsolute ( options . layoutPath ) ? options . layoutPath : path . join ( process . cwd ( ) , options . layoutPath ) , layout ) ; try { layoutContents = fs . readFileSync ( layoutPath , 'utf8' ) ; } catch ( err ) { throw new PluginError ( logFlag , 'Could not read layout: \'' + layoutPath + '\'\n' ) ; } layoutCache [ layout ] = { contents : layoutContents , path : layoutPath } ; } return layoutCache [ layout ] ; }
read a layout file from given path; store it in cache object for further
usage; return object with layout contents and absolute path
@param  {string}   layout path to layout
@return {object}          layout contents and path
read a layout file from given path ; store it in cache object for further usage ; return object with layout contents and absolute path