sass-graph.js
function resolveSassPath(sassPath, loadPaths, extensions) {
  // trim sass file extensions
  var re = new RegExp('(\.('+extensions.join('|')+'))$', 'i');
  var sassPathName = sassPath.replace(re, '');
  // check all load paths
  var i, j, length = loadPaths.length, scssPath, partialPath;
  for (i = 0; i < length; i++) {
    for (j = 0; j < extensions.length; j++) {
      scssPath = path.normalize(loadPaths[i] + '/' + sassPathName + '.' + extensions[j]);
      try {
        if (fs.lstatSync(scssPath).isFile()) {
          return scssPath;
        }
      } catch (e) {}
    }

    // special case for _partials
    for (j = 0; j < extensions.length; j++) {
      scssPath = path.normalize(loadPaths[i] + '/' + sassPathName + '.' + extensions[j]);
      partialPath = path.join(path.dirname(scssPath), '_' + path.basename(scssPath));
      try {
        if (fs.lstatSync(partialPath).isFile()) {
          return partialPath;
        }
      } catch (e) {}
    }
  }

  // File to import not found or unreadable so we assume this is a custom import
  return false;
}
function resolveSassPath(sassPath, loadPaths, extensions) {
  // trim sass file extensions
  var re = new RegExp('(\.('+extensions.join('|')+'))$', 'i');
  var sassPathName = sassPath.replace(re, '');
  // check all load paths
  var i, j, length = loadPaths.length, scssPath, partialPath;
  for (i = 0; i < length; i++) {
    for (j = 0; j < extensions.length; j++) {
      scssPath = path.normalize(loadPaths[i] + '/' + sassPathName + '.' + extensions[j]);
      try {
        if (fs.lstatSync(scssPath).isFile()) {
          return scssPath;
        }
      } catch (e) {}
    }

    // special case for _partials
    for (j = 0; j < extensions.length; j++) {
      scssPath = path.normalize(loadPaths[i] + '/' + sassPathName + '.' + extensions[j]);
      partialPath = path.join(path.dirname(scssPath), '_' + path.basename(scssPath));
      try {
        if (fs.lstatSync(partialPath).isFile()) {
          return partialPath;
        }
      } catch (e) {}
    }
  }

  // File to import not found or unreadable so we assume this is a custom import
  return false;
}
function resolveSassPath ( sassPath , loadPaths , extensions ) { // trim sass file extensions var re = new RegExp ( '(\.(' + extensions . join ( '|' ) + '))$' , 'i' ) ; var sassPathName = sassPath . replace ( re , '' ) ; // check all load paths var i , j , length = loadPaths . length , scssPath , partialPath ; for ( i = 0 ; i < length ; i ++ ) { for ( j = 0 ; j < extensions . length ; j ++ ) { scssPath = path . normalize ( loadPaths [ i ] + '/' + sassPathName + '.' + extensions [ j ] ) ; try { if ( fs . lstatSync ( scssPath ) . isFile ( ) ) { return scssPath ; } } catch ( e ) { } } // special case for _partials for ( j = 0 ; j < extensions . length ; j ++ ) { scssPath = path . normalize ( loadPaths [ i ] + '/' + sassPathName + '.' + extensions [ j ] ) ; partialPath = path . join ( path . dirname ( scssPath ) , '_' + path . basename ( scssPath ) ) ; try { if ( fs . lstatSync ( partialPath ) . isFile ( ) ) { return partialPath ; } } catch ( e ) { } } } // File to import not found or unreadable so we assume this is a custom import return false ; }
resolve a sass module to a path
resolve a sass module to a path