src/node/LayoutTemplate.js
function lookupFile(conf, fileRelative) {
  const relativeToFile = path.resolve(conf.filepath, fileRelative);
  if (layoutHelper.store.exist(relativeToFile)) {
    return relativeToFile;
  }

  if (conf.settings && conf.settings.views) {
    if (!Array.isArray(conf.settings.views)) {
      const fromView = path.resolve(conf.settings.views, fileRelative);
      if (layoutHelper.store.exist(fromView)) {
        return fromView;
      }
    }

    for (let i = 0; i < conf.settings.views.length; i += 1) {
      const fromView = path.resolve(conf.settings.views[i], fileRelative);
      if (layoutHelper.store.exist(fromView)) {
        return fromView;
      }
    }
  }

  return relativeToFile;
}
function lookupFile(conf, fileRelative) {
  const relativeToFile = path.resolve(conf.filepath, fileRelative);
  if (layoutHelper.store.exist(relativeToFile)) {
    return relativeToFile;
  }

  if (conf.settings && conf.settings.views) {
    if (!Array.isArray(conf.settings.views)) {
      const fromView = path.resolve(conf.settings.views, fileRelative);
      if (layoutHelper.store.exist(fromView)) {
        return fromView;
      }
    }

    for (let i = 0; i < conf.settings.views.length; i += 1) {
      const fromView = path.resolve(conf.settings.views[i], fileRelative);
      if (layoutHelper.store.exist(fromView)) {
        return fromView;
      }
    }
  }

  return relativeToFile;
}
function lookupFile ( conf , fileRelative ) { const relativeToFile = path . resolve ( conf . filepath , fileRelative ) ; if ( layoutHelper . store . exist ( relativeToFile ) ) { return relativeToFile ; } if ( conf . settings && conf . settings . views ) { if ( ! Array . isArray ( conf . settings . views ) ) { const fromView = path . resolve ( conf . settings . views , fileRelative ) ; if ( layoutHelper . store . exist ( fromView ) ) { return fromView ; } } for ( let i = 0 ; i < conf . settings . views . length ; i += 1 ) { const fromView = path . resolve ( conf . settings . views [ i ] , fileRelative ) ; if ( layoutHelper . store . exist ( fromView ) ) { return fromView ; } } } return relativeToFile ; }
Lookup files for express from
- relative to current file
- relative to views
@param {object} conf - The configuration
@param {string} fileRelative - The relative path of the file
Lookup files for express from - relative to current file - relative to views