lib/templating.js
function relativePathTo(from, to, strip) {
  var relPath = path.relative(from.replace(path.basename(from), ''), to);
  if (relPath.match(/^\.\.?(\/|\\)/) === null) { relPath = './' + relPath; }
  if (strip) { return relPath.replace(/((\/|\\)index\.js|\.js)$/, ''); }
  return relPath;
}
function relativePathTo(from, to, strip) {
  var relPath = path.relative(from.replace(path.basename(from), ''), to);
  if (relPath.match(/^\.\.?(\/|\\)/) === null) { relPath = './' + relPath; }
  if (strip) { return relPath.replace(/((\/|\\)index\.js|\.js)$/, ''); }
  return relPath;
}
function relativePathTo ( from , to , strip ) { var relPath = path . relative ( from . replace ( path . basename ( from ) , '' ) , to ) ; if ( relPath . match ( / ^\.\.?(\/|\\) / ) === null ) { relPath = './' + relPath ; } if ( strip ) { return relPath . replace ( / ((\/|\\)index\.js|\.js)$ / , '' ) ; } return relPath ; }
Templating related utilities
@module yo-utils/lib/templating
 
Returns a relative path used to require the 'to' file in the 'from' file
@alias module:yo-utils/lib/templating.relativePathTo
@param  {String}  from  - file path to the from file
@param  {String}  to    - file path to the to file
@param  {Boolean} strip - whether to strip the index file name and/or the js ext
@return {String}        - relative path to be used in require statements
Templating related utilities